fix(docker): run frontend builder on BUILDPLATFORM to fix esbuild crash under QEMU

esbuild (used by Vite) crashes under QEMU amd64 emulation on Apple Silicon,
the same way the Go runtime did.  Building the frontend on the native platform
is safe because the output (HTML/CSS/JS) contains no architecture-specific code.
This commit is contained in:
Siddharth Kumar Sah 2026-04-15 23:20:40 +08:00
parent 7b4b2569f2
commit 6a3ad0d496

View file

@ -7,7 +7,10 @@
# ============================================
# Stage 1: Build the frontend (Vite + React)
# ============================================
FROM node:22-bookworm AS builder
# Run on the native build platform to avoid QEMU crashes with esbuild on
# Apple Silicon. The output (HTML/CSS/JS) is architecture-agnostic so it
# is safe to build on arm64 and copy into the amd64 production layer.
FROM --platform=$BUILDPLATFORM node:22-bookworm AS builder
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate