Docker Multi-Stage Helper
v1.0.0Multi-stage Dockerfile pattern picker — build / test / run stages, cache mounts, distroless.
Dockerfile (multi-stage)
# Build stage FROM node:20-alpine AS builder WORKDIR /app COPY package*.json . RUN npm ci --frozen-lockfile COPY . . RUN npm run build # Production stage FROM node:20-alpine AS production WORKDIR /app RUN addgroup -S appgroup && adduser -S appuser -G appgroup USER appuser COPY --from=builder /app/dist ./dist COPY --from=builder /app/node_modules ./node_modules COPY package.json . EXPOSE 3000 CMD ["node", "dist/index.js"] # Build: docker build -t my-app . # Run: docker run -p 3000:3000 my-app