multi-stage-dockerfile
Skill3 starsChanged 3 months agoMITView on GitHub
Creates and reviews secure, cache-friendly multi-stage Dockerfiles for Node, web, backend, and static-site projects. Use when writing Dockerfiles, optimizing image size, separating build/runtime stages, hardening containers, fixing slow Docker builds, or preparing production images.
- Reads credentials
11 other projects use a version of this.
Adopted by
Most recently taken up by
- github/awesome-copilottheir own version, first seen Oct 25, 2026
- ragna-ai/ragna-studiotheir own version, first seen Oct 11, 2026
- ZeroTokenClaw/agents-skillstheir own version, first seen Sep 21, 2026
- idexal/idexal-skillstheir own version, first seen Aug 26, 2026
- ElyzeSolutions/skillstheir own version, first seen Aug 6, 2026
- KhaledSaeed18/node-express-boilerplatetheir own version, first seen Jul 15, 2026
Used with
Projects with it also use web-design-guidelines and improve-codebase-architecture.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
VercelSkillweb-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
Also in 3 projects that use this
GoogleSkillimprove-codebase-architecture
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- github/awesome-copilot★ 41ksame name
- KhaledSaeed18/node-express-boilerplate★ 36same name
- idexal/idexal-skills★ 2same name
- kimtth/agent-skill-100-lines-or-less★ 2same name
- ElyzeSolutions/skills★ 1same name
- iCesofT/awesome-ai★ 1same name
- ragna-ai/ragna-studio★ 1same name
- Streamlinity/claude-skills-deploy★ 1same name
- ZeroTokenClaw/agents-skills★ 1same name
- jenreh/appkit-bpmn-server★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-designSkill
- backend-craftSkill
- meilisearchSkill
- design-coreSkill
- design-datavizSkill
- design-flowsSkill
- design-formsSkill
- design-product-uiSkill
- design-researchSkill
- design-reviewSkill
- design-slidesSkill
- design-systemsSkill
- design-webSkill
- agent-syncSkill
- build-autonomous-agentsSkill
- coding-disciplineSkill
- completion-gateSkill
- deliver-dependency-upgradesSkill
- documentation-and-adrsSkill
- grill-harness-with-docsSkill
- learn-agentic-engineeringSkill
- pnpmSkill
- scaffold-harnessSkill
- scaffold-monorepoSkill
- shift-left-securitySkill
- start-gateSkill
- update-harnessSkill
- write-a-skillSkill
- frontend-craftSkill
- ansible-automationSkill
- gitea-actionsSkill
- gitea-teaSkill
- manage-infrastructure-as-codeSkill
- secure-linux-web-hostingSkill
- integrate-product-complianceSkill
- plain-numbersSkill
- product-craftSkill
- run-product-engineeringSkill
- playwright-best-practicesSkill
- testing-strategiesSkill
- writing-coreSkill
- writing-editorialSkill
- writing-engineeringSkill
- writing-marketingSkill
- writing-productSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 12 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this for production-oriented Dockerfiles where build dependencies, runtime dependencies, security, and cache behavior should be …
- Distinctive: line 13
Before writing a Dockerfile:
- Distinctive: line 17
Read existing Dockerfiles, compose files, CI image build jobs, and deployment docs.
- Distinctive: line 20
Do not introduce Alpine, distroless, rootless, or monorepo pruning patterns without checking framework/native dependency compatibility.
- Distinctive: line 22
If the image is deployed by CI, align build args, secrets, labels, and tags with that pipeline.
- Distinctive: line 34
Keep dependency install before source copy so source changes do not invalidate the dependency cache.
- Distinctive: line 39
Use the lockfile with the matching package manager.
- Distinctive: line 41
Keep build secrets out of final layers.
- Very specific: line 42
Use .dockerignore to exclude node_modules, build output, VCS metadata, local env files, and caches.
- Very specific: line 44
Prefer explicit CMD and documented EXPOSE.
- Distinctive: line 45
Use health checks only when the deployment platform respects them.
- Distinctive: line 46
Add OCI labels if the registry/deploy process uses them.
- Distinctive: line 50
Avoid root in the final image when the runtime allows it.
- Very specific: line 51
Never bake .env, tokens, SSH keys, or registry credentials into layers.
- Distinctive: line 52
Keep package manager caches out of the final image.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Multi-Stage Dockerfile
Use this for production-oriented Dockerfiles where build dependencies, runtime dependencies, security, and cache behavior should be explicit.
Project Fit Check
Before writing a Dockerfile:
- Detect runtime, package manager, lockfile, build output, server command, and required native dependencies.
- Read existing Dockerfiles, compose files, CI image build jobs, and deployment docs.
- Preserve the project's base-image policy, registry, and runtime user model.
- Do not introduce Alpine, distroless, rootless, or monorepo pruning patterns without checking framework/native dependency compatibility.
- If the image is deployed by CI, align build args, secrets, labels, and tags with that pipeline.
Structure
Default shape:
base: shared runtime image and environmentdeps: install dependencies from lockfilebuild: copy source and build artifactsruntime: copy only runtime files and run as non-root when possible
Keep dependency install before source copy so source changes do not invalidate the dependency cache.
Rules
- Use the lockfile with the matching package manager.
- Copy only needed files between stages.
- Keep build secrets out of final layers.
- Use
.dockerignoreto excludenode_modules, build output, VCS metadata, local env files, and caches. - Prefer explicit
CMDand documentedEXPOSE. - Use health checks only when the deployment platform respects them.
- Add OCI labels if the registry/deploy process uses them.
Security
- Avoid root in the final image when the runtime allows it.
- Never bake
.env, tokens, SSH keys, or registry credentials into layers. - Keep package manager caches out of the final image.
- Pin base image by digest when supply-chain policy requires reproducibility.
- Rebuild regularly for base image security patches.
Verification
docker build -t local-test .
docker run --rm local-test <smoke command>For web services, run the container and hit a health or homepage route.
Red Flags
- one-stage image with compilers and dev dependencies in production
COPY . .before dependency install- missing
.dockerignore - final image runs as root without a reason
- secrets passed via
ARGand kept in image history - container command differs from documented deploy command
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

