
Multi Stage Dockerfile
The multi-stage-dockerfile skill helps developers create optimized Docker container images by guiding them through best practices for multi-stage builds, base image selection, layer optimization, and security hardening. It addresses the problem of bloated, insecure, or inefficient container images by providing specific techniques for separating build and runtime stages, minimizing final image size, and reducing security vulnerabilities. This skill is for software developers and DevOps engineers working with containerized applications across any language or framework who want to improve build efficiency and image quality.
- skills.sh installs
- 31.5K
- GitHub stars
- 41K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add github/awesome-copilot --skill multi-stage-dockerfile --agent claude-codeInstalls into .claude/skills of the current project.
Files
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
ASkeyword (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-slimnot justpython) - 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
Sponsors
Details
- Repository
- github.com/github/awesome-copilot
- Categories
- Git & Pull Requests, AI & Agent Building
More from github/awesome-copilot
All 318- Documentation Writer28.4K
- Prd24.4K
- Refactor22.6K
- Java Springboot21.8K
- Gh Cli21.2K
- Create Readme19.5K
- Playwright Generate Test18.2K
- Github Issues17.7K
- Conventional Commit17.3K
- Postgresql Optimization16.9K
- Dotnet Best Practices16.1K
- Sql Optimization16K
- Sql Code Review15.6K
- Chrome Devtools15.4K
- Microsoft Docs15K
- Playwright Explore Website14.8K
- Azure Devops Cli14.8K
- Javascript Typescript Jest14.5K
- Nuget Manager14.5K
- Microsoft Code Reference14.4K
- Web Design Reviewer14.3K
- Playwright Automation Fill In Form13.7K
- Create Specification13.6K
- Game Engine13.4K