agentleFS
GitHubKnown publishergithub/awesome-copilot/skills/multi-stage-dockerfile/SKILL.md

multi-stage-dockerfile

Skill40k starsChanged 2 months agoMITView on GitHub

Create optimized multi-stage Dockerfiles for any language or framework

5 other projects use a version of this, 1 of them edited.

How people change it

All 1 edited versions we compared keep every one of its 17 rules.

Of the 1 edited version we compared: 1 keep every rule.

We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.

Trending

More talk lately.about the whole repository

Dec 2025: 8 mentionsJan 2026: 4 mentionsFeb 2026: 5 mentionsMar 2026: 9 mentionsApr 2026: 4 mentionsMay 2026: 2 mentionsJun 2026: 2 mentionsJul 2026: 2 mentionsAug 2026: 4 mentionsSep 2026: 8 mentionsOct 2026: 4 mentionsNov 2026: 3 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the github/awesome-copilot repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about github/awesome-copilot

The biggest 5 of 79 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 79

Talked about on Bluesky, GitHub and Hacker News (79 times).

On Bluesky · 42

37 more on Bluesky

On GitHub · 32

27 more on GitHub

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 13 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use a builder stage for compilation, dependency installation, and other build-time operations

    line 10
  2. Distinctive:

    Use a separate runtime stage that only includes what's needed to run the application

    line 11
  3. Very specific:

    Use meaningful stage names with the AS keyword (e.g., FROM node:18 AS builder)

    line 13
  4. Distinctive:

    Place stages in logical order: dependencies → build → test → runtime

    line 14
  5. Distinctive:

    Start with official, minimal base images when possible

    line 18
  6. Distinctive:

    Consider distroless images for runtime stages where appropriate

    line 20
  7. Distinctive:

    Use Alpine-based images for smaller footprints when compatible with your application

    line 21
  8. Distinctive:

    Ensure the runtime image has the minimal necessary dependencies

    line 22
  9. Distinctive:

    Place commands that change frequently (like code changes) after commands that change less frequently (like dependency installation)

    line 27
  10. Very specific:

    Use .dockerignore to prevent unnecessary files from being included in the build context

    line 28
  11. Very specific:

    Consider using COPY --chown to set permissions in one step

    line 30
  12. Very specific:

    Avoid running containers as root - use USER instruction to specify a non-root user

    line 34
  13. Distinctive:

    Remove build tools and unnecessary packages from the final image

    line 35
  14. Distinctive:

    Use multi-stage builds to avoid including build secrets in the final image

    line 38
  15. Distinctive:

    Use build arguments for configuration that might change between environments

    line 42
  16. Distinctive:

    Consider parallelization in build steps when possible

    line 44
  17. Distinctive:

    Use appropriate healthchecks for the application type with the HEALTHCHECK instruction

    line 46

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.