dockerfile-optimise

📁 pproenca/dot-skills 📅 14 days ago
28
总安装量
28
周安装量
#12961
全站排名
安装命令
npx skills add https://github.com/pproenca/dot-skills --skill dockerfile-optimise

Agent 安装分布

codex 25
github-copilot 24
gemini-cli 24
opencode 23
cursor 23
kimi-cli 22

Skill 文档

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