mirror of
https://github.com/caprover/caprover
synced 2026-08-23 16:06:45 +00:00
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.
29 lines
777 B
Plaintext
29 lines
777 B
Plaintext
# 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 && \
|
|
npm ci --omit=dev && \
|
|
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
|
|
|
|
ENV NODE_ENV production
|
|
ENV PORT 3000
|
|
EXPOSE 3000
|
|
|
|
CMD ["node" , "./built/server.js"] |