dockerfile-pro

Solid

Authors small, secure, reproducible multi-stage Dockerfiles with build-cache optimization, pinned base images, non-root runtime users, and minimal attack surface. Use this skill when writing, reviewing, hardening, or shrinking a Dockerfile or container image — e.g. "write a Dockerfile", "containerize this app", "my image is too big", "make this container secure / non-root", "optimize Docker build cache", "multi-stage build", "reduce image layers", "fix Docker best practices", or "review my Dockerfile".

AI & Automation 3 stars 2 forks Updated today MIT

Install

View on GitHub

Quality Score: 79/100

Stars 20%
20
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# dockerfile-pro ## Overview Produce production-grade Dockerfiles that are **small** (minimal final image), **secure** (non-root, pinned, no secrets, minimal surface), and **reproducible** (deterministic builds with effective layer caching). Applies to any language runtime (Go, Rust, Node, Python, Java, .NET, etc.) and any registry. Keywords: Dockerfile, container, multi-stage build, build cache, BuildKit, non-root user, distroless, alpine, slim, image size, layer caching, `.dockerignore`, HEALTHCHECK, OCI image, supply chain, reproducible build, hadolint, Trivy. The three goals (small / secure / reproducible) often align, but when they conflict, prioritize **security > reproducibility > size**. ## Workflow Follow these steps in order when authoring or reviewing a Dockerfile. 1. **Identify the app shape.** Compiled binary (Go/Rust/C++) → use a `FROM scratch` or `distroless` final stage. Interpreted/runtime (Node/Python/Java/.NET) → use the matching `-slim`/`distroless` runtime image. JVM/CLR may need a JRE-only final image. 2. **Always use multi-stage.** A `builder` stage installs toolchains and compiles/installs dependencies; the final stage copies only the runtime artifacts. Never ship compilers, package caches, or dev headers. 3. **Pin everything.** Pin the base image by tag **and** digest (`image:tag@sha256:...`). Pin OS and language package versions. This is what makes builds reproducible. 4. **Order layers from least- to most-frequently-changing.** Copy dependenc...

Details

Author
JayRHa
Repository
JayRHa/AgentSkills
Created
1 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category