Skip to content

Commit 270c3e2

Browse files
bugerclaude
andcommitted
fix: make Docker images backward compatible with runAsUser: 1000
- Remove --chown=65532:65532 from COPY for non-FIPS builds - Add chmod -R a+rX so files are world-readable regardless of uid - FIPS/DHI builds pass NONROOT_CHOWN=true for proper nonroot ownership Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9792d07 commit 270c3e2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ jobs:
176176
build-args: |
177177
BUILD_PACKAGE_NAME=tyk-gateway-ee
178178
BASE_IMAGE=tykio/dhi-busybox:1.37-fips
179+
NONROOT_CHOWN=true
179180
- name: Docker metadata for ee tag push
180181
id: tag_metadata_ee
181182
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
@@ -211,6 +212,7 @@ jobs:
211212
build-args: |
212213
BUILD_PACKAGE_NAME=tyk-gateway-ee
213214
BASE_IMAGE=tykio/dhi-busybox:1.37-fips
215+
NONROOT_CHOWN=true
214216
- name: Attach base image VEX to ee
215217
if: ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
216218
run: |
@@ -259,6 +261,7 @@ jobs:
259261
build-args: |
260262
BUILD_PACKAGE_NAME=tyk-gateway-fips
261263
BASE_IMAGE=tykio/dhi-busybox:1.37-fips
264+
NONROOT_CHOWN=true
262265
- name: Docker metadata for fips tag push
263266
id: tag_metadata_fips
264267
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
@@ -293,6 +296,7 @@ jobs:
293296
build-args: |
294297
BUILD_PACKAGE_NAME=tyk-gateway-fips
295298
BASE_IMAGE=tykio/dhi-busybox:1.37-fips
299+
NONROOT_CHOWN=true
296300
- name: Attach base image VEX to fips
297301
if: ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
298302
run: |

ci/Dockerfile.distroless

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ ENV DEBIAN_FRONTEND=noninteractive
1010

1111
# The _ after the pkg name is to match tyk-gateway strictly and not tyk-gateway-fips (for example)
1212
COPY ${BUILD_PACKAGE_NAME}_*${TARGETARCH}.deb /
13-
RUN dpkg -i /${BUILD_PACKAGE_NAME}_*${TARGETARCH}.deb && rm /*.deb
13+
ARG NONROOT_CHOWN=false
14+
RUN dpkg -i /${BUILD_PACKAGE_NAME}_*${TARGETARCH}.deb && rm /*.deb \
15+
&& chmod -R a+rX /opt/tyk-gateway/ \
16+
&& if [ "$NONROOT_CHOWN" = "true" ]; then chown -R 65532:65532 /opt/tyk-gateway/; fi
1417

1518
FROM ${BASE_IMAGE}
1619

17-
COPY --chown=65532:65532 --from=deb /opt/tyk-gateway /opt/tyk-gateway
20+
COPY --from=deb /opt/tyk-gateway /opt/tyk-gateway
1821

1922
ARG PORTS
2023
EXPOSE $PORTS

0 commit comments

Comments
 (0)