docker
Installation
SKILL.md
Docker Best Practices
Dockerfile
- Use specific base image tags (not :latest)
- Use multi-stage builds for smaller images
- Minimize layers (combine RUN commands)
- Copy package.json first for caching
- Run as non-root user
- Use .dockerignore
Example Multi-stage Build
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build