fix: Dockerfile uses npm prune instead of npm ci for production deps
The run stage no longer runs npm ci --omit=dev (which fails when package-lock.json and the Docker environment's resolved deps are out of sync, e.g. @emnapi/* transitive deps from adapter-node). Instead, the build stage runs npm prune --omit=dev after building, and the run stage copies the already-pruned node_modules. This avoids any lock file sync issues across different environments.
This commit is contained in:
BIN
.env.docker
BIN
.env.docker
Binary file not shown.
@@ -9,16 +9,17 @@ RUN npm ci
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Prune dev dependencies for the production image
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
# ---- Run stage ----
|
||||
FROM node:22-alpine AS run
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
COPY --from=build /app/package.json ./
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY --from=build /app/build ./build
|
||||
COPY --from=build /app/package.json .
|
||||
|
||||
ENV PORT=3000
|
||||
ENV HOST=0.0.0.0
|
||||
|
||||
Reference in New Issue
Block a user