From 5a29edc8ede50209d64c04bcca86bbc617c9ebde Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Jul 2026 03:09:23 +0000 Subject: [PATCH 1/2] Initial plan From f4b662d037737434654fdf2f3d9e57e3aa25f064 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Jul 2026 03:15:42 +0000 Subject: [PATCH 2/2] Fix arm64 Docker build failure: use multi-stage build with --platform=$BUILDPLATFORM The linux/arm64 Docker builds were failing with "Illegal instruction" (exit code 132/SIGILL) because Node.js 22 uses CPU instructions that QEMU's ARM64 emulation on GitHub Actions runners does not support. Fix: convert dockerfile-captain.edge and dockerfile-captain.release to multi-stage builds where the build stage uses --platform=$BUILDPLATFORM so all npm/Node.js commands run on the native host platform (amd64), bypassing QEMU entirely. The final stage copies the complete /usr/src/app directory from the builder and uses the target platform's Node.js runtime without running any build commands. --- dockerfile-captain.edge | 13 ++++++++++--- dockerfile-captain.release | 14 +++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/dockerfile-captain.edge b/dockerfile-captain.edge index f53e8bb..a7c0db8 100644 --- a/dockerfile-captain.edge +++ b/dockerfile-captain.edge @@ -1,10 +1,10 @@ -FROM node:22-alpine -RUN apk add --update --no-cache make gcc g++ git curl openssl openssh +# Build stage runs on the host platform to avoid QEMU SIGILL issues with Node.js 22 on arm64 +FROM --platform=$BUILDPLATFORM node:22-alpine AS builder +RUN apk add --update --no-cache make gcc g++ git curl openssl WORKDIR /usr/src/app COPY . ./ - # Build backend code RUN npm ci && \ npm run build && \ @@ -12,6 +12,13 @@ RUN npm ci && \ npm cache clean --force && \ mv ./edge-override.json ./config-override.json +# Final stage uses the target platform's Node.js runtime +FROM node:22-alpine +RUN apk add --update --no-cache git curl openssl openssh + +WORKDIR /usr/src/app +COPY --from=builder /usr/src/app . + # This quick hack invalidates the cache. ADD https://www.google.com /time.now diff --git a/dockerfile-captain.release b/dockerfile-captain.release index 2481167..6b733fc 100644 --- a/dockerfile-captain.release +++ b/dockerfile-captain.release @@ -1,5 +1,6 @@ -FROM node:22-alpine -RUN apk add --update --no-cache make gcc g++ git curl openssl openssh +# Build stage runs on the host platform to avoid QEMU SIGILL issues with Node.js 22 on arm64 +FROM --platform=$BUILDPLATFORM node:22-alpine AS builder +RUN apk add --update --no-cache make gcc g++ git curl openssl WORKDIR /usr/src/app COPY . ./ @@ -9,7 +10,14 @@ RUN npm ci && \ npm run build && \ npm ci --omit=dev && \ npm cache clean --force - + +# Final stage uses the target platform's Node.js runtime +FROM node:22-alpine +RUN apk add --update --no-cache git curl openssl openssh + +WORKDIR /usr/src/app +COPY --from=builder /usr/src/app . + ENV NODE_ENV production ENV PORT 3000 EXPOSE 3000