bdafac2908
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>
35 lines
896 B
Docker
35 lines
896 B
Docker
# 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
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=4173
|
|
|
|
ARG COMMIT_SHA=unknown
|
|
ENV COMMIT_SHA=${COMMIT_SHA}
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
COPY dist ./dist
|
|
COPY server.js ./server.js
|
|
COPY server/ ./server/
|
|
COPY A_Study_of_Titus.pdf ./A_Study_of_Titus.pdf
|
|
|
|
# Copy seed data to a separate directory so the entrypoint can seed /app/data
|
|
# only when no live data exists yet — upgrades never overwrite existing data.
|
|
COPY data ./data-seed
|
|
|
|
RUN mkdir -p /app/data
|
|
|
|
COPY entrypoint.sh ./entrypoint.sh
|
|
RUN chmod +x ./entrypoint.sh
|
|
|
|
EXPOSE 4173
|
|
ENTRYPOINT ["./entrypoint.sh"]
|