Skip to content

Build sim image multi-arch (amd64 + arm64) for Apple Silicon#31

Merged
YWHyuk merged 1 commit into
mainfrom
claude/sim-image-multiarch
May 18, 2026
Merged

Build sim image multi-arch (amd64 + arm64) for Apple Silicon#31
YWHyuk merged 1 commit into
mainfrom
claude/sim-image-multiarch

Conversation

@YWHyuk
Copy link
Copy Markdown

@YWHyuk YWHyuk commented May 18, 2026

Summary

Publishes ghcr.io/psal-postech/llmservingsimspec/sim:latest as a multi-arch manifest covering both linux/amd64 (x86 hosts, x86 CI) and linux/arm64 (Apple Silicon Macs, ARM servers). Apple Silicon users get the native arm64 variant automatically when they run docker pull.

Why multi-arch and not just a separate Mac image

docker pull <ref> resolves the manifest list to the runner's arch. One ref, one tag, everyone gets the right binary. Mac users don't have to know to pull a different tag.

Native runners, no QEMU

ASTRA-Sim is a C++ build via cmake. Under x86 + QEMU arm64 emulation that compile balloons from ~5-7 min to ~30-60 min and crowds the GHA 6-hour budget. GitHub now ships free ubuntu-24.04-arm runners for public repos (since Jan 2025), so we build natively on each platform in parallel and combine the digests afterwards.

Workflow shape

Standard matrix-with-merge pattern from the docker/build-push-action docs:

  1. build matrix — one row per platform on its own native runner.
    • PR: verify build only.
    • Push to main / dispatch: push by digest (no tag yet), upload the digest to an artifact.
  2. merge — collects per-platform digests, runs docker buildx imagetools create with the human-readable tags (latest, sha-<short>, branch name) pointing at the union of those digests.

PRs skip the merge job since no digests were published.

BuildKit cache is scoped per platform so amd64 and arm64 don't trample each other's cache.

Other tweaks

  • .dockerignore added to the trigger path filter — future tweaks to it rebuild the image.

Test plan

  • PR CI build runs both build (linux/amd64) and build (linux/arm64) to green. The merge job is skipped for PRs (intentional).
  • After merge, the workflow publishes a multi-arch :latest manifest. Verify with docker buildx imagetools inspect ghcr.io/psal-postech/llmservingsimspec/sim:latest — should list both linux/amd64 and linux/arm64.
  • On an Apple Silicon Mac: docker run --rm ghcr.io/psal-postech/llmservingsimspec/sim:latest uname -maarch64.
  • On an x86 host: same command → x86_64.

Notes

  • ubuntu-24.04-arm runners are free for public repos. If this repo turns private later, that runner becomes paid (per-minute billing); falling back to QEMU on ubuntu-latest would be the alternative at the cost of ~5× longer arm64 builds.
  • The arm64 build re-runs the same scripts/sim.Dockerfile — no Dockerfile changes needed. ASTRA-Sim's cmake build is portable.

Generated by Claude Code

Mac users on Apple Silicon (M1+) need a linux/arm64 image to run the
sim container natively under Docker Desktop. Publishing a multi-arch
manifest is invisible to users: ``docker pull`` resolves the right
variant for the runner's arch automatically — Apple Silicon picks
arm64, x86 hosts pick amd64.

Workflow restructure (.github/workflows/build-sim-image.yml):

* Matrix-with-merge pattern from the docker/build-push-action docs:
  https://docs.docker.com/build/ci/github-actions/multi-platform/
* Each platform builds natively on its own GHA runner — ubuntu-latest
  for amd64, ubuntu-24.04-arm (free for public repos since Jan 2025)
  for arm64. Avoids QEMU emulation, which on a C++ build like
  ASTRA-Sim blows the compile from ~5-7 min to ~30-60 min and risks
  the GHA 6-hour budget.
* Per-platform job pushes by digest only (no tag). The merge job
  collects digests via actions/upload-artifact and assembles them
  into a tagged manifest list via ``docker buildx imagetools create``.
* PRs verify each platform builds but skip both publish and the merge
  step.
* BuildKit cache scoped per platform (``cache-from/-to ... scope=<key>``)
  so different archs don't trample each other's cache.

Also adds ``.dockerignore`` to the trigger path filter so future tweaks
to it rebuild the image.
@YWHyuk YWHyuk merged commit 6577776 into main May 18, 2026
2 checks passed
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.

2 participants