dockerfile-optimizer
SkillCloud & infraAudits Dockerfiles for multi-stage build efficiency, layer caching, non-root security, and minimal base image footprint.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the dockerfile-optimizer skill
What this skill tells your AI
The instructions your AI receives, as published by codebygarv/ai-skills in skills/utilities/dockerfile-optimizer/SKILL.md and read by ahel’s review.
Purpose
Analyze and optimize container Dockerfiles for minimal image size (Alpine / Distroless), lightning-fast layer caching, non-root security hardening, and clean signal handling.
When to Use
- Container image builds take minutes instead of seconds in CI.
- Production images are bloated (e.g. 1.5GB for a simple Node or Go binary).
- Security vulnerability scans flag build toolchains (gcc, git, npm) present in production runtime images.
What to Analyze
- Multi-Stage Builds: Separate build-time dependencies (compilers, devDependencies) from lean runtime artifacts.
- Layer Caching Optimization: Copy lockfiles and install dependencies before copying entire application source code.
- Base Image Selection: Use minimal, patched base images (
node:20-alpine,gcr.io/distroless/static,chainguard). - Security Hardening: Explicit non-root user creation (
USER node/USER nonroot), removing package managers from final image. - Execution Mechanics: Use exec form (
ENTRYPOINT ["node", "server.js"]) rather than shell form to ensure proper PID 1 signal forwarding.
Output Format
- Optimized Dockerfile: Production-ready, commented multi-stage Dockerfile.
- Image Size Comparison: Estimated reduction (e.g. 1.2GB $ ightarrow$ 85MB).
- Security & Caching Improvements: Explanation of layer order and user hardening.
Avoid
- Running containers as root (
UID 0) in production. - Using
ADDinstead ofCOPYfor local files.
Signals
- GitHub stars
- 25
- Forks
- 1
- Last commit
- Aug 2026
Advanced
- Catalog kind
- skill
- Gateway key
dockerfile-optimizer- Source
- github.com/codebygarv/ai-skills