Skip to content

fix(docker): split build stages to avoid ARM64 QEMU crash#199

Merged
steilerDev merged 1 commit into
betafrom
fix/docker-arm64-qemu-crash
Feb 23, 2026
Merged

fix(docker): split build stages to avoid ARM64 QEMU crash#199
steilerDev merged 1 commit into
betafrom
fix/docker-arm64-qemu-crash

Conversation

@steilerDev
Copy link
Copy Markdown
Owner

Summary

  • Splits the single builder Docker stage into client-builder (native arch) + builder (target arch) to eliminate intermittent ARM64 QEMU crashes during multi-platform builds
  • The client-builder stage uses --platform=$BUILDPLATFORM to run webpack natively, bypassing QEMU entirely for the crash-prone V8 JIT step
  • The builder stage only runs tsc under QEMU (lightweight, safe), plus npm ci to compile better-sqlite3 for the target architecture

Context

Since multi-arch builds were added (PR #133, 2026-02-19), ~20% of release.yml runs fail on ARM64 with exit code 132 (SIGILL — Illegal instruction) during webpack --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

  • PR CI runs the Docker job (docker build -t cornerstone:e2e .) — validates the 3-stage Dockerfile builds correctly on amd64
  • After merge to beta, verify release.yml multi-platform buildx (linux/amd64,linux/arm64) succeeds without the QEMU crash

🤖 Generated with Claude Code

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>
@steilerDev steilerDev merged commit 9169470 into beta Feb 23, 2026
5 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.9.0-beta.42 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@steilerDev steilerDev deleted the fix/docker-arm64-qemu-crash branch February 23, 2026 08:24
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