Fix arm64 Docker build crash (QEMU illegal instruction); v1.1.13

Run npm ci on the native build platform using --platform=\$BUILDPLATFORM in a
deps stage, then copy node_modules to the runtime image. Avoids running Node.js
under QEMU emulation, which crashes with SIGILL on arm64 cross-builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-07-28 10:53:29 -04:00
parent ce235ba9ef
commit bdafac2908
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -1,3 +1,10 @@
# Install prod deps on the native builder platform to avoid QEMU npm crashes
# during cross-platform builds. All deps are pure-JS so this is safe.
FROM --platform=$BUILDPLATFORM node:22-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev --legacy-peer-deps
FROM node:22-alpine AS runtime
WORKDIR /app
@@ -7,8 +14,7 @@ ENV PORT=4173
ARG COMMIT_SHA=unknown
ENV COMMIT_SHA=${COMMIT_SHA}
COPY package*.json ./
RUN npm ci --omit=dev --legacy-peer-deps
COPY --from=deps /app/node_modules ./node_modules
COPY dist ./dist
COPY server.js ./server.js