fix(docker): split build stages to avoid ARM64 QEMU crash#199
Merged
Conversation
The multi-platform Docker build (linux/amd64,linux/arm64) intermittently fails on ARM64 with exit code 132 (SIGILL) during webpack because V8's JIT compiler generates machine code that QEMU cannot emulate. Split the single builder stage into two: - client-builder: runs on $BUILDPLATFORM (native arch), builds shared types (tsc) and client bundle (webpack) without QEMU - builder: runs on target arch (QEMU for ARM64), installs native addons (better-sqlite3), copies pre-built shared/client, builds server (tsc only — lightweight and QEMU-safe) The client-builder uses --ignore-scripts to skip better-sqlite3 compilation since no native addons are needed for shared/client builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 1.9.0-beta.42 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
builderDocker stage intoclient-builder(native arch) +builder(target arch) to eliminate intermittent ARM64 QEMU crashes during multi-platform buildsclient-builderstage uses--platform=$BUILDPLATFORMto run webpack natively, bypassing QEMU entirely for the crash-prone V8 JIT stepbuilderstage only runstscunder QEMU (lightweight, safe), plusnpm cito compilebetter-sqlite3for the target architectureContext
Since multi-arch builds were added (PR #133, 2026-02-19), ~20% of
release.ymlruns fail on ARM64 with exit code 132 (SIGILL— Illegal instruction) duringwebpack --mode production. The root cause is V8's JIT compiler non-deterministically generating machine code that QEMU's ARM64 emulation can't execute. This will only get worse as the webpack bundle grows.Test plan
Dockerjob (docker build -t cornerstone:e2e .) — validates the 3-stage Dockerfile builds correctly on amd64beta, verifyrelease.ymlmulti-platform buildx (linux/amd64,linux/arm64) succeeds without the QEMU crash🤖 Generated with Claude Code