Skip to content

Publish multi-arch (amd64 + arm64) container images#135

Merged
scotwells merged 1 commit into
mainfrom
multiarch-build
May 5, 2026
Merged

Publish multi-arch (amd64 + arm64) container images#135
scotwells merged 1 commit into
mainfrom
multiarch-build

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

Summary

  • Our published container images today are amd64-only, which means developers on Apple Silicon (and any arm64 environment) cannot pull and run them without emulation. This PR switches the publish workflow to build and push both linux/amd64 and linux/arm64 images.
  • The Dockerfile was unintentionally forcing QEMU emulation whenever arm64 was requested. It's now pinned to the runner's native architecture and cross-compiles the Go binary, which is the standard fast path for pure-Go projects and keeps CI times low.
  • Local multi-arch build wall-clock after the fix: ~49 seconds (cold-ish, on an M-series laptop). Prior QEMU-based arm64 builds were 15+ minutes.
  • Also threads version / gitCommit / gitTreeState / buildDate into the manager binary via -ldflags -X so published images carry build metadata and log it at startup.

Test plan

  • CI publish workflow runs green on this PR
  • docker buildx imagetools inspect ghcr.io/datum-cloud/network-services-operator:<tag> shows both linux/amd64 and linux/arm64
  • Pulling and running the image on an Apple Silicon machine works without emulation warnings

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

The Dockerfile declared ARG TARGETOS/TARGETARCH but did not pin the
builder stage to BUILDPLATFORM, so requesting linux/arm64 caused
BuildKit to pull the arm64 golang image and run the entire build under
QEMU emulation. This pins the builder to the runner's native
architecture and cross-compiles via GOARCH, which is the standard fast
path for pure-Go projects.

Also threads version/gitCommit/gitTreeState/buildDate through
-ldflags -X so images carry build metadata, and bumps the shared
publish-docker workflow to v1.13.1 to enable the platforms input
(linux/amd64,linux/arm64).

Unblocks Apple Silicon developers who currently cannot pull the
published image without emulation. Local multi-arch buildx build
completes in ~49s on an M-series laptop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@scotwells scotwells requested review from a team and JoseSzycho May 5, 2026 21:33
@scotwells scotwells merged commit f7d8178 into main May 5, 2026
10 of 11 checks passed
@scotwells scotwells deleted the multiarch-build branch May 5, 2026 22:52
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.

3 participants