Course → Practical Lab assessments → Lab readiness checkpoints
Practical Lab assessments
Dockerfile checkpoint
12 min · Module 1
Choose the right Dockerfile instructions for a production Node.js app: multi-stage builds, non-root user, and minimal base images reduce attack surface and image size.
Shell, YAML & config examples
# Multi-stage build example
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
RUN addgroup -S app && adduser -S app -G app
COPY --from=build /app/dist ./dist
USER app
CMD ["node", "dist/server.js"]
Hands-on practice: /lab/scenarios/dockerfile/