skills/pproenca/dot-skills/dockerfile-optimise

dockerfile-optimise

SKILL.md

Dockerfile Optimization Best Practices

Comprehensive Dockerfile optimization guide sourced exclusively from official Docker documentation. Contains 48 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Writing new Dockerfiles or modifying existing ones
  • Optimizing Docker build times (layer caching, cache mounts, context management)
  • Reducing Docker image size (multi-stage builds, minimal base images)
  • Hardening container security (secret mounts, non-root users, attestations)
  • Setting up CI/CD pipelines with Docker builds
  • Reviewing Dockerfiles for anti-patterns

Rule Categories by Priority

Priority Category Impact Prefix
1 Layer Caching & Ordering CRITICAL cache-
2 Multi-Stage Builds CRITICAL stage-
3 Base Image Selection HIGH base-
4 Build Context Management HIGH ctx-
5 Security & Secrets HIGH sec-
6 Dependency Management MEDIUM-HIGH dep-
7 Instruction Patterns MEDIUM inst-
8 Quality & Validation MEDIUM lint-

Quick Reference

1. Layer Caching & Ordering (CRITICAL)

2. Multi-Stage Builds (CRITICAL)

3. Base Image Selection (HIGH)

4. Build Context Management (HIGH)

5. Security & Secrets (HIGH)

6. Dependency Management (MEDIUM-HIGH)

7. Instruction Patterns (MEDIUM)

8. Quality & Validation (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

File Description
references/_sections.md Category definitions and ordering
assets/templates/_template.md Template for new rules
metadata.json Version and reference information
Weekly Installs
46
GitHub Stars
71
First Seen
Feb 15, 2026
Installed on
codex43
github-copilot42
gemini-cli42
opencode41
cursor41
kimi-cli40