docker
Dockerfile authoring rules distilled from Docker's official best practices.
npx rulepack add docker
What it covers
- Multi-stage builds — separate build env from a lean runtime image
- Minimal, pinned (version + digest) official base images
- Cache-friendly instruction ordering (least → most frequently changing)
- Layer hygiene: combine
RUNcommands, clean up in the same layer, sort args apt-getdone right (update + install in oneRUN, prune lists)COPYoverADD; exec-formCMD/ENTRYPOINT; absoluteWORKDIR- Security: run as non-root
USER, never bake secrets (RUN --mount=type=secret) .dockerignore, one concern per container, ephemeral/stateless design
Source
Distilled from Docker's official documentation: https://docs.docker.com/build/building/best-practices/
License
MIT