Skip to content

Fix cross-platform container build without QEMU#8

Merged
conallob merged 1 commit into
mainfrom
claude/fix-container-build
May 6, 2026
Merged

Fix cross-platform container build without QEMU#8
conallob merged 1 commit into
mainfrom
claude/fix-container-build

Conversation

@conallob
Copy link
Copy Markdown
Owner

@conallob conallob commented May 6, 2026

Problem

When goreleaser builds the arm64 image on the amd64 CI runner, the FROM alpine:3 AS certs stage pulls the arm64 Alpine image and tries to run the arm64 apk binary — which fails without QEMU/binfmt_misc configured.

Fix

Add --platform=linux/amd64 to the certs builder stage:

FROM --platform=linux/amd64 alpine:3 AS certs

This 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.crt is equally valid in the arm64 final image. The FROM scratch stage is pure file copies — no code execution — so no emulation is needed there either.

Test plan

  • Release tag push produces both ghcr.io/conallob/coding-interview-pattern-drill:<tag>-amd64 and ...-arm64 images
  • Multi-arch manifest is pushed to :<tag> and :latest
  • podman run --platform linux/arm64 ghcr.io/conallob/coding-interview-pattern-drill:latest --version returns the correct tag

Generated by Claude Code

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.
@conallob conallob merged commit 5249d80 into main May 6, 2026
2 checks passed
@conallob conallob deleted the claude/fix-container-build branch May 6, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant