mcpField
D
dockerfile-optimise

dockerfile-optimise

github.com/pproencaCloud & DevOps218347 installsUpdated 11w ago
Repository

About dockerfile-optimise

A Dockerfile optimization guide for developers writing, reviewing, or building container images. Its 48 prioritized rules are sourced exclusively from official Docker documentation and cover caching, image size, security, and validation.

Key features

  1. 0148 rules across eight categories
  2. 02Prioritizes guidance by impact
  3. 03Covers layer caching and multi-stage builds
  4. 04Addresses image selection and build context
  5. 05Includes secrets, dependencies, and validation

Use cases

  1. 01Optimize Docker build times
  2. 02Reduce container image size
  3. 03Review Dockerfiles for security practices
  4. 04Configure Docker builds in CI/CD

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill dockerfile-optimise

After installing, type/dockerfile-optimisein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

metadata.json
assets/templates/
_template.md
references/
_sections.md
base-arg-version.md
base-distroless.md
base-minimal-image.md
base-official-images.md
base-pin-versions.md
base-rebuild-regularly.md
cache-apt-combine.md
cache-copy-deps-first.md
cache-copy-link.md
cache-external.md
cache-invalidation.md
cache-layer-order.md
cache-minimize-layers.md
cache-mount-package.md
ctx-bind-mounts.md
ctx-dockerignore.md
ctx-minimize-context.md
ctx-syntax-directive.md
dep-cache-mount-apt.md
dep-cache-mount-npm.md
dep-cache-mount-pip.md
dep-cleanup-caches.md
dep-version-pin.md
inst-copy-over-add.md
inst-entrypoint-exec.md
inst-healthcheck.md
inst-heredoc-scripts.md

Details

From the project README

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

PriorityCategoryImpactPrefix
1Layer Caching & OrderingCRITICALcache-
2Multi-Stage BuildsCRITICALstage-
3Base Image SelectionHIGHbase-
4Build Context ManagementHIGHctx-
5Security & SecretsHIGHsec-
6Dependency ManagementMEDIUM-HIGHdep-
7Instruction PatternsMEDIUMinst-
8Quality & ValidationMEDIUMlint-

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

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information

Comments

Markdown supported