npm ci silently skips devDependencies when NODE_ENV=production is set in the environment, which broke the build (nest: not found) once Coolify injected NODE_ENV=production as a build-time var. --include=dev makes the build stage robust regardless of that env var; the runtime stage now does its own --omit=dev install instead of copying the build stage's node_modules wholesale, keeping the final image prod-only.
15 lines
363 B
Docker
15 lines
363 B
Docker
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --legacy-peer-deps --include=dev
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
FROM node:22-alpine
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --legacy-peer-deps --omit=dev
|
|
COPY --from=build /app/dist ./dist
|
|
EXPOSE 3001
|
|
CMD ["node", "dist/main"]
|