Skip to content

Commit 534adb2

Browse files
bugerclaude
andauthored
fix: make Docker images backward compatible with runAsUser: 1000 (#8106)
## Summary - Remove `--chown=65532:65532` from non-FIPS Dockerfile builds to restore backward compatibility with helm charts using `runAsUser: 1000` - Files are made world-readable via `chmod -R a+rX` - FIPS/DHI builds still get proper 65532 ownership via `NONROOT_CHOWN` build arg ## Test plan - [ ] Gateway starts with `runAsUser: 1000` (old helm default) - [ ] Gateway starts with `runAsUser: 65532` - [ ] FIPS image still has proper nonroot ownership 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9fd2e43 commit 534adb2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ jobs:
230230
labels: ${{ steps.ci_metadata_fips.outputs.labels }}
231231
build-args: |
232232
BUILD_PACKAGE_NAME=tyk-gateway-fips
233+
NONROOT_CHOWN=true
233234
- name: Docker metadata for fips tag push
234235
id: tag_metadata_fips
235236
uses: docker/metadata-action@v5
@@ -263,6 +264,7 @@ jobs:
263264
labels: ${{ steps.tag_metadata_fips.outputs.labels }}
264265
build-args: |
265266
BUILD_PACKAGE_NAME=tyk-gateway-fips
267+
NONROOT_CHOWN=true
266268
- name: Docker metadata for std CI
267269
id: ci_metadata_std
268270
if: ${{ matrix.golang_cross == '1.25-bullseye' }}

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)