pproenca avatar

Dockerfile Optimise

This is a comprehensive reference of 48 Docker optimization rules pulled straight from official Docker docs, organized into 8 priority-ranked categories from layer caching to security hardening. It's designed to trigger when you're writing or reviewing Dockerfiles, giving you specific patterns like cache mounts for package managers, multi-stage build strategies, and secret mount handling. The rules come with impact ratings (CRITICAL/HIGH/MEDIUM) so you know what actually matters for build time and image size versus what's just polish. Honestly most useful as a systematic checklist when you're past the "just get it working" stage and want to do things properly, especially the cache invalidation and base image selection guidance that people usually learn through pain.

skills.sh installs
351
GitHub stars
222
last updated
Aug 21, 2026

Install

$ npx -y skills add pproenca/dot-skills --skill dockerfile-optimise --agent claude-code

Installs into .claude/skills of the current project.

Files

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-

Sponsors

Details

Repository
github.com/pproenca/dot-skills
Categories
Security, DevOps & CI/CD, Documentation, Code Review & Quality
First seen
Jun 3, 2026

More from pproenca/dot-skills

All 100

Recommended

More Security
1siviter-xyz avatarbackend-engineersiviter-xyz/dot-agentBuild robust backend systems with modern technologies (Node.js, Python, Go, Rust), frameworks (NestJS, FastAPI, Django), databases (PostgreSQL, MongoDB, Redis),349skills.sh installs
2sanjay3290 avatargoogle-chatsanjay3290/ai-skillsInteract with Google Chat - list spaces, send messages, read conversations, and manage DMs. Use when user asks to: send a message on Google Chat, read chat mess347skills.sh installs
3jezweb avatartypescript-mcpjezweb/claude-skillsBuild MCP servers with TypeScript on Cloudflare Workers. Covers tools, resources, prompts, tasks, authentication (API keys, OAuth, Zero Trust), and Cloudflare s335skills.sh installs
4jezweb avatarazure-authjezweb/claude-skillsMicrosoft Entra ID (Azure AD) authentication for React SPAs with MSAL.js and Cloudflare Workers JWT validation using jose library. Full-stack pattern with Autho327skills.sh installs
5sanjay3290 avataratlassiansanjay3290/ai-skillsManage Jira issues and Confluence wiki pages in Atlassian Cloud. Use when: (1) searching/creating/updating Jira issues with JQL, (2) searching/reading/creating 327skills.sh installs
6dauquangthanh avatarkeycloak-administrationdauquangthanh/hanoi-rainbowProvides comprehensive KeyCloak administration guidance including realm management, user/group administration, client configuration, authentication flows, ident324skills.sh installs