multi-stage-dockerfile

multi-stage-dockerfile is a skill for Claude Code, Codex from OKHP3/skillz. It costs 17 tokens per session (441 once invoked), scanned A, a copy of multi-stage-dockerfile, MIT.

A guide for creating multi-stage Dockerfiles for applications in different languages and frameworks. Dockerfiles define how an application is packaged into a container, and multi-stage builds separate building from running.

In plain words
What is it for?
Use it to create Docker build, dependency, test, and runtime stages for an application, with attention to image size and reproducibility.
Why use it?
It helps keep runtime images smaller by leaving build tools and unnecessary files behind. It also covers versioned base images, caching, minimal dependencies, and more secure runtime contents.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/okhp3/skillz/multi-stage-dockerfile
Any agent
npx skills add OKHP3/skillz --skill multi-stage-dockerfile
Clone the repo
git clone --depth 1 https://github.com/OKHP3/skillz

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for multi-stage-dockerfile

README.md
[![agentmods](https://agentmods.dev/badge/skills/okhp3/skillz/multi-stage-dockerfile.svg)](https://agentmods.dev/skills/okhp3/skillz/multi-stage-dockerfile)
Your own site
<a href="https://agentmods.dev/skills/okhp3/skillz/multi-stage-dockerfile"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/multi-stage-dockerfile.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 441 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.00441
Opus 5 $0.00009 $0.00220
Sonnet 5 $0.00003 $0.00088
Haiku 4.5 $0.00002 $0.00044

Measured 2d ago against content hash 7dfea7d31f37, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

multi-stage-dockerfile scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to multi-stage-dockerfile — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

community/multi-stage-dockerfile/SKILL.md · 47 lines

How it starts

The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Your goal is to help me create efficient multi-stage Dockerfiles that follow best practices, resulting in smaller, more secure container images.

Multi-Stage Structure

  • Use a builder stage for compilation, dependency installation, and other build-time operations
  • Use a separate runtime stage that only includes what's needed to run the application
  • Copy only the necessary artifacts from the builder stage to the runtime stage
  • Use meaningful stage names with the AS keyword (e.g., FROM node:18 AS builder)
  • Place stages in logical order: dependencies → build → test → runtime

Base Images

  • Start with official, minimal base images when possible
  • Specify exact version tags to ensure reproducible builds (e.g., python:3.11-slim not just python)
  • Consider distroless images for runtime stages where appropriate
  • Use Alpine-based images for smaller footprints when compatible with your application
  • Ensure the runtime image has the minimal necessary dependencies

Layer Optimization

  • Organize commands to maximize layer caching
  • Place commands that change frequently (like code changes) after commands that change less frequently (like dependency installation)
  • Use .dockerignore to prevent unnecessary files from being included in the build context
  • Combine related RUN commands with && to reduce layer count
  • Consider using COPY --chown to set permissions in one step

Security Practices

  • Avoid running containers as root - use USER instruction to specify a non-root user
  • Remove build tools and unnecessary packages from the final image
  • Scan the final image for vulnerabilities
  • Set restrictive file permissions
  • Use multi-stage builds to avoid including build secrets in the final image

Performance Considerations

  • Use build arguments for configuration that might change between environments
  • Leverage build cache efficiently by ordering layers from least to most frequently changing
  • Consider parallelization in build steps when possible
  • Set appropriate environment variables like NODE_ENV=production to optimize runtime behavior
  • Use appropriate healthchecks for the application type with the HEALTHCHECK instruction

Read the full file on GitHub · 47 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 47 lines · 17 tokens per session scan A 7dfea7d31f37

Subscribe to this mod's changes

multi-stage-dockerfile is a skill published in the GitHub repository OKHP3/skillz (3 stars, last pushed yesterday), licensed MIT. It adds 17 tokens to every session and 441 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to multi-stage-dockerfile, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

docker-compose

Use this skill when authoring or editing Docker Compose files (compose.yaml / docker-compose.yml), running multi-container stacks, or containerizing a Drupal/PHP application — e.g. "set up a local Drupal stack with nginx and MariaDB", "add Redis to my compose file", "why won't my containers start", "split dev and prod…

siva01c/claude-plugins · 100 tokens

lxd-docker-firewall-conflict

Diagnose and fix the well-known Docker/LXD firewall conflict on a host running both. Docker sets the iptables FORWARD chain policy to DROP and accepts only its own bridges, so forwarded traffic from the LXD bridge (lxdbr0) is silently dropped and LXD containers/VMs get no outbound internet (the host itself is fine).…

soulmachine/skills · 255 tokens

ubuntu-lxd-gpu-server

Install LXD on an Ubuntu server and pass all NVIDIA GPUs into LXD system containers via CDI — install snapd+LXD (snap), run lxd init with a ZFS or dir storage pool, set up a host CDI spec at /etc/cdi and wire the nvidia-container-toolkit auto-refresh units so it stays fresh across driver upgrades, and grant every GPU…

soulmachine/skills · 211 tokens

manage-mounts

Configure which host directories agent containers can access. View, add, or remove mount allowlist entries. Triggers on "mounts", "mount allowlist", "agent access to directories", "container mounts".

nanocoai/nanoclaw · 47 tokens

vastai-sdk

Vast.ai Python SDK — high-level API for GPU instances, volumes, serverless endpoints, and billing.

vast-ai/vast-cli · 26 tokens

pm-agile

Use when: 项目启动时需要建立敏捷开发流程、设计团队协作机制、规划迭代节奏 Do NOT use when: 团队已有成熟敏捷流程、仅需单一项目管理工具而非流程设计.

konglong87/superPM · 57 tokens