Project rules
Docker Rules
Project rules for Dockerfiles and Compose: multi-stage builds, pinned base images, non-root users, layer caching and health checks.
1Dockerfile
2- Use multi-stage builds: a build stage with compilers and a final stage with only the runtime and the built output. Prefer slim or distroless bases.
3- Pin base images to a specific version, and to a digest for releases. Never use `latest`.
4- Order instructions for caching: copy dependency manifests, install, then copy source. Combine package manager steps and clean caches in the same `RUN`. Use BuildKit cache mounts for package downloads.
5- Use `COPY`, not `ADD`, unless you need extraction. Keep a strict `.dockerignore` that excludes `.git`, `node_modules`, local env files and build output.
docker
Docker Rules
Project rulesdocker
Free