Build a multi-arch (amd64 + arm64) image #4

Merged
aneurin merged 1 commits from ci/multi-arch-build into main 2026-09-07 00:42:59 +00:00
Owner

Builds code.aneur.in/zampler/zampler:latest as an amd64 + arm64 manifest list so it can run on the Pi and on common x86 machines from the same tag.

Approach

Zampler is pure Go with cgo disabled (modernc.org/sqlite), so both arches cross-compile from the amd64 runner at native speed with no emulation. The runtime Dockerfile has no RUN steps, so buildx assembles the arm64 image on the amd64 host without QEMU too. The arm64 runner is intentionally not used — see #3 for why, and the pros/cons of revisiting that.

Changes

  • build.yml: Build binary → cross-compile dist/zampler-linux-{amd64,arm64}; new buildx setup step (docker-container driver); promote :latest:previous via buildx imagetools create (copies the manifest list registry-side instead of pull/tag/push); final step is one docker buildx build --platform linux/amd64,linux/arm64 --push. Added docker-cli-buildx to apk add.
  • Dockerfile: ARG TARGETARCH + COPY dist/zampler-linux-${TARGETARCH}.
  • .dockerignore / .gitignore: track the new dist/ layout.

Verified locally

Cross-compile of both arches (correct static ELF, pure-Go confirmed); Dockerfile + .dockerignore + TARGETARCH interpolation; buildx accepting the two-platform matrix. Not verifiable locally (Docker Hub rate limit): the real --push manifest-list publish, and that the runner permits the docker-container buildx driver — watch the first main build.

🤖 Generated with Claude Code

Builds `code.aneur.in/zampler/zampler:latest` as an amd64 + arm64 manifest list so it can run on the Pi and on common x86 machines from the same tag. ## Approach Zampler is pure Go with cgo disabled (`modernc.org/sqlite`), so both arches cross-compile from the amd64 runner at native speed with no emulation. The runtime Dockerfile has no `RUN` steps, so `buildx` assembles the arm64 image on the amd64 host without QEMU too. The `arm64` runner is intentionally not used — see #3 for why, and the pros/cons of revisiting that. ## Changes - **build.yml**: `Build binary` → cross-compile `dist/zampler-linux-{amd64,arm64}`; new buildx setup step (`docker-container` driver); promote `:latest`→`:previous` via `buildx imagetools create` (copies the manifest list registry-side instead of pull/tag/push); final step is one `docker buildx build --platform linux/amd64,linux/arm64 --push`. Added `docker-cli-buildx` to `apk add`. - **Dockerfile**: `ARG TARGETARCH` + `COPY dist/zampler-linux-${TARGETARCH}`. - **.dockerignore / .gitignore**: track the new `dist/` layout. ## Verified locally Cross-compile of both arches (correct static ELF, pure-Go confirmed); Dockerfile + `.dockerignore` + `TARGETARCH` interpolation; buildx accepting the two-platform matrix. Not verifiable locally (Docker Hub rate limit): the real `--push` manifest-list publish, and that the runner permits the `docker-container` buildx driver — watch the first `main` build. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
aneurin added 1 commit 2026-09-07 00:40:27 +00:00
build a multi-arch (amd64 + arm64) image
PR Checks / checks (pull_request) Successful in 2m17s
321e4dc9ec
Zampler is pure Go with CGO disabled (modernc.org/sqlite), so both
architectures cross-compile from the amd64 runner at native speed with
no emulation. The runtime Dockerfile has no RUN steps, so buildx can
assemble the arm64 image on the amd64 host without QEMU too.

- Cross-compile dist/zampler-linux-{amd64,arm64} in one job.
- Dockerfile copies dist/zampler-linux-${TARGETARCH}; buildx sets
  TARGETARCH per platform leg.
- Replace `docker build`/`push` with a single `docker buildx build
  --platform linux/amd64,linux/arm64 --push`, producing a manifest list
  at :latest.
- Promote :latest to :previous with `buildx imagetools create`, which
  copies the manifest list registry-side instead of pulling a single
  arch and re-pushing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
aneurin merged commit 7f57e25dcf into main 2026-09-07 00:42:59 +00:00
aneurin deleted branch ci/multi-arch-build 2026-09-07 00:42:59 +00:00
Sign in to join this conversation.