docker-syntax-multistage
Installation
SKILL.md
docker-syntax-multistage
Quick Reference
Multi-Stage Build Concept
A multi-stage build uses multiple FROM instructions in a single Dockerfile. Each FROM starts a new stage. Only the final stage (or the --target stage) produces the output image. Earlier stages exist solely to generate artifacts that are copied into later stages.
Stage Types
| Stage Type | Purpose | Final Image? |
|---|---|---|
| Builder | Compile code, run bundlers, generate artifacts | No |
| Test | Run test suites, linting, static analysis | No |
| Dependencies | Install and cache shared dependencies | No |
| Production | Minimal runtime with only required artifacts | Yes |
| Debug | Production + debugging tools | Yes (dev only) |
Image Size Impact
Related skills