From 1a3aaea9332e9c3aa093160ccf947e3a5cd3d779 Mon Sep 17 00:00:00 2001 From: Tianyu Liu Date: Sat, 13 Jun 2026 17:21:05 +0200 Subject: [PATCH] fix(docker): pin frontend-build to $BUILDPLATFORM to avoid QEMU V8 crash Multi-arch image builds (linux/amd64,linux/arm64) emulate the foreign arch via QEMU. The unpinned `FROM node:22-slim` frontend-build stage was built per target arch, so Node ran under emulation and V8's baseline JIT crashed (SIGTRAP / exit 133 on `npm ci`) on the CI runner's QEMU. Pin the stage to --platform=$BUILDPLATFORM so the static, arch-independent SPA dist/ is built once on the native build host and COPYd into each arch's runtime stage. Node never runs emulated; both arch images are still produced. --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ded6532..e4b39ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ -# Stage 1: build the React SPA -FROM node:22-slim AS frontend-build +# Stage 1: build the React SPA. +# Pin to the native build host ($BUILDPLATFORM) so the Node/V8 build never runs +# under QEMU during multi-arch builds — emulated Node crashes V8's baseline JIT +# (SIGTRAP / exit 133 on `npm ci`). The dist/ output is static JS/CSS, i.e. +# architecture-independent, so building it once and COPYing it into each +# target-arch runtime stage is both correct and avoids the emulator entirely. +FROM --platform=$BUILDPLATFORM node:22-slim AS frontend-build WORKDIR /frontend