fix(ci): add linux/arm64 Docker build with QEMU optimization#76
Merged
Conversation
- Add docker/setup-qemu-action@v3 to docker-publish.yml (was missing, causing multi-platform builds to hang indefinitely) - Add platforms: linux/amd64,linux/arm64 to build-push-action step - Optimize Dockerfile with --platform=$BUILDPLATFORM on builder stages so TypeScript compilation runs at native amd64 speed; only the lean npm ci --omit=dev step runs under QEMU in the final stage, compiling the three native modules (bcrypt, better-sqlite3, node-pty) for the correct target architecture — reduces arm64 build time from 6+ hours to ~15-30 minutes
AnsoCode
force-pushed
the
feat/arm64-docker-build
branch
from
March 24, 2026 11:45
9d2d812 to
059961a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Adding
platforms: linux/amd64,linux/arm64to the Docker publish workflow caused the job to hit the 6-hour GitHub Actions timeout and fail.Root cause — two issues combined:
docker-publish.ymlwas missingsetup-qemu-actionentirely. Without it, multi-platform builds hang indefinitely rather than failing fast.npm install(full dev dependency tree including 3 native C++ modules:bcrypt,better-sqlite3,node-pty) entirely under QEMU ARM64 emulation — ~10-20x slower than native. Compiling those three modules under QEMU alone can take several hours.Minutes impact: A 6-hour timeout on the free GitHub plan = 360 minutes consumed per failed run (18% of the 2,000 free monthly Linux minutes).
Solution
docker-publish.ymldocker/setup-qemu-action@v3(was missing)platforms: linux/amd64,linux/arm64to the build-push stepDockerfile— cross-compilation optimization$BUILDPLATFORM(amd64, native)npm install+vite build$BUILDPLATFORM(amd64, native)npm install+tsc$TARGETPLATFORM(arm64 via QEMU)npm ci --omit=devonlyTypeScript output is platform-agnostic JS — safe to compile on amd64 and copy to arm64. Only the production
npm ci --omit=devruns under QEMU, compiling the 3 native modules for the correct target architecture.Estimated build time: ~15–30 min (vs 6+ hours / timeout before)
Changes
.github/workflows/docker-publish.yml— add QEMU setup, add platformsDockerfile—--platform=$BUILDPLATFORMon builder stages, lean production install in final stage