Skip to content

feat(build): Switch to docker hardened image - #6335

Merged
Dav1dde merged 3 commits into
masterfrom
atarasov/feat/dhi-base-image
Sep 1, 2026
Merged

feat(build): Switch to docker hardened image#6335
Dav1dde merged 3 commits into
masterfrom
atarasov/feat/dhi-base-image

Conversation

@oioki

@oioki oioki commented Aug 28, 2026

Copy link
Copy Markdown
Member

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 to d91c0db.

oioki and others added 2 commits August 28, 2026 14:45
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
oioki marked this pull request as ready for review August 28, 2026 12:48
@oioki
oioki requested a review from a team as a code owner August 28, 2026 12:49
Comment thread Dockerfile.release
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Dav1dde added the Trigger: Full-CI Runs all CI steps in a PR label Sep 1, 2026
@Dav1dde
Dav1dde enabled auto-merge September 1, 2026 12:48
@Dav1dde
Dav1dde added this pull request to the merge queue Sep 1, 2026
Merged via the queue into master with commit 6096402 Sep 1, 2026
45 checks passed
@Dav1dde
Dav1dde deleted the atarasov/feat/dhi-base-image branch September 1, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Trigger: Full-CI Runs all CI steps in a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants