feat(build): Switch to docker hardened image - #6335
Merged
Merged
Conversation
Reapplies #6117, which switched the release container base image from distroless to the mirrored Docker Hardened Image. It was reverted in #6234 because Cloud Build could not pull the resulting images: buildx published them with zstd-compressed layers, which the Docker version used by Cloud Build does not understand. Bump action-build-and-push-images to d91c0db, which forces gzip layer compression on published images, so the produced images stay pullable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T3KHEMjFFwVv2vdDVuzLuN
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T3KHEMjFFwVv2vdDVuzLuN
oioki
marked this pull request as ready for review
August 28, 2026 12:48
Comment on lines
+12
to
+13
| COPY --from=builder --chown=nonroot:nonroot /home/nonroot /etc/relay | ||
| COPY --from=builder --chown=nonroot:nonroot /home/nonroot /work |
There was a problem hiding this comment.
Bug: The COPY instruction may not create /etc/relay and /work if /home/nonroot is empty, leading to incorrect root ownership when VOLUME creates them later.
Severity: CRITICAL
Suggested Fix
Instead of relying on COPY to create the directories, explicitly create them and set their ownership before the VOLUME instruction. For example, use RUN mkdir /etc/relay /work && chown nonroot:nonroot /etc/relay /work before copying any files into them.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: Dockerfile.release#L12-L13
Potential issue: The Dockerfile uses `COPY --from=builder /home/nonroot ...` to create
the `/etc/relay` and `/work` directories with `nonroot` ownership. However, Docker's
`COPY` instruction does not copy empty directories. If the source `/home/nonroot`
directory is empty, as a code comment suggests, the `COPY` commands will not create the
destination directories. The subsequent `VOLUME` instruction will then create them at
runtime, but they will be owned by `root`. When the application, running as the
`nonroot` user, tries to access these directories, it will likely fail with permission
denied errors.
Did we get this right? 👍 / 👎 to inform future reviews.
Dav1dde
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another attempt of #6117 (switching to Docker Hardened Image)
#6234 reverted it because Cloud Build could not pull the resulting images — buildx published them with zstd-compressed layers, which the Docker version Cloud Build runs does not understand. That is now fixed upstream in
action-build-and-push-images(#21), which forces gzip layer compression on published images, so this bumps the pinned action tod91c0db.