Fix cross-platform container build without QEMU#8
Merged
Conversation
Pin the certs builder stage to linux/amd64 so it runs natively on the amd64 CI runner regardless of the target image arch. The final scratch stage is pure file copies so no emulation is needed for arm64 builds.
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.
Problem
When goreleaser builds the arm64 image on the amd64 CI runner, the
FROM alpine:3 AS certsstage pulls the arm64 Alpine image and tries to run the arm64apkbinary — which fails without QEMU/binfmt_misc configured.Fix
Add
--platform=linux/amd64to the certs builder stage:FROM --platform=linux/amd64 alpine:3 AS certsThis forces the intermediate stage to always run as amd64 (native on the CI runner), regardless of the target image platform. CA certificates are architecture-independent, so the copied
ca-certificates.crtis equally valid in the arm64 final image. TheFROM scratchstage is pure file copies — no code execution — so no emulation is needed there either.Test plan
ghcr.io/conallob/coding-interview-pattern-drill:<tag>-amd64and...-arm64images:<tag>and:latestpodman run --platform linux/arm64 ghcr.io/conallob/coding-interview-pattern-drill:latest --versionreturns the correct tagGenerated by Claude Code