Skip to content

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

Merged
scotwells merged 1 commit intomainfrom
multiarch-build
Apr 9, 2026
Merged

Publish multi-arch (amd64 + arm64) container images#82
scotwells merged 1 commit intomainfrom
multiarch-build

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

Summary

The published ghcr.io/datum-cloud/workload-operator image is currently built for linux/amd64 only. That blocks anyone running the downstream e2e environments on Apple Silicon — Docker has to fall back to emulation, which is slow and unreliable.

This PR publishes the image for both linux/amd64 and linux/arm64 so the same image runs natively on both architectures. Pulling by tag continues to work exactly as before; consumers automatically get the right variant for their machine.

Why it's fast

A previous attempt at this reportedly took 15+ minutes per build because the builder was running under emulation. This PR teaches the build to cross-compile natively instead, which is the standard fast path for pure-Go projects. Locally verified with docker buildx:

Build Wall-clock
Cold cache, both architectures ~47s
Warm cache, both architectures ~7s

That's roughly the same as today's amd64-only build, with arm64 added effectively for free.

As a small bonus, the binary now records its version, git commit, git tree state, and build date, and logs them on startup — useful for debugging which image is actually running in a cluster.

Backwards compatibility

  • Image tags and the registry path are unchanged. Anything pulling ghcr.io/datum-cloud/workload-operator:<tag> continues to work and now transparently gets the right architecture.
  • Flux's image-controller, image-updater, kubectl, and containerd all handle multi-architecture images natively — no consumer changes needed.
  • Local make docker-build is unchanged and still produces a host-architecture image for development.
  • This PR also picks up a newer version of the shared publish workflow (datum-cloud/actions v1.5.1 → v1.13.1), which slightly changes how non-release tags are formatted (e.g. branch and SHA tags are now prefixed with v0.0.0- so they're semver-compatible). Anything pinning the old branch/SHA tag formats may need a small follow-up.

Test plan

  • CI publish workflow runs green on a branch push and produces a multi-architecture manifest at ghcr.io/datum-cloud/workload-operator:<branch-tag>
  • docker buildx imagetools inspect ghcr.io/datum-cloud/workload-operator:<tag> shows both linux/amd64 and linux/arm64
  • Pulling and running the image on an Apple Silicon machine works without emulation
  • Operator startup log shows the stamped version/commit/build-date values

🤖 Generated with Claude Code

Adds linux/arm64 to the published image so Apple Silicon developers
can run the operator locally without QEMU.

- Dockerfile: pin builder to BUILDPLATFORM and cross-compile to
  TARGETARCH so arm64 builds run natively on amd64 runners (and
  vice versa) instead of under emulation.
- Dockerfile: stamp version metadata into the binary via -ldflags
  using the VERSION/GIT_COMMIT/GIT_TREE_STATE/BUILD_DATE build args
  the shared publish workflow already provides.
- cmd/main.go: log the stamped build metadata on startup.
- publish.yaml: bump the shared publish-docker workflow to v1.13.1
  and request linux/amd64,linux/arm64.

Verified locally with docker buildx: cold multi-arch build is ~47s,
warm rebuild is ~7s, both architectures cross-compile natively.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@scotwells scotwells merged commit 46c1a78 into main Apr 9, 2026
9 checks passed
@scotwells scotwells deleted the multiarch-build branch April 9, 2026 02:14
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