{"kind":"Skill","metadata":{"namespace":"community","name":"multi-stage-dockerfile","version":"0.1.0"},"spec":{"description":"Create optimized multi-stage Dockerfiles for any language or framework","files":{"SKILL.md":"---\nname: multi-stage-dockerfile\ndescription: 'Create optimized multi-stage Dockerfiles for any language or framework'\n---\n\nYour goal is to help me create efficient multi-stage Dockerfiles that follow best practices, resulting in smaller, more secure container images.\n\n## Multi-Stage Structure\n\n- Use a builder stage for compilation, dependency installation, and other build-time operations\n- Use a separate runtime stage that only includes what's needed to run the application\n- Copy only the necessary artifacts from the builder stage to the runtime stage\n- Use meaningful stage names with the `AS` keyword (e.g., `FROM node:18 AS builder`)\n- Place stages in logical order: dependencies → build → test → runtime\n\n## Base Images\n\n- Start with official, minimal base images when possible\n- Specify exact version tags to ensure reproducible builds (e.g., `python:3.11-slim` not just `python`)\n- Consider distroless images for runtime stages where appropriate\n- Use Alpine-based images for smaller footprints when compatible with your application\n- Ensure the runtime image has the minimal necessary dependencies\n\n## Layer Optimization\n\n- Organize commands to maximize layer caching\n- Place commands that change frequently (like code changes) after commands that change less frequently (like dependency installation)\n- Use `.dockerignore` to prevent unnecessary files from being included in the build context\n- Combine related RUN commands with `\u0026\u0026` to reduce layer count\n- Consider using COPY --chown to set permissions in one step\n\n## Security Practices\n\n- Avoid running containers as root - use `USER` instruction to specify a non-root user\n- Remove build tools and unnecessary packages from the final image\n- Scan the final image for vulnerabilities\n- Set restrictive file permissions\n- Use multi-stage builds to avoid including build secrets in the final image\n\n## Performance Considerations\n\n- Use build arguments for configuration that might change between environments\n- Leverage build cache efficiently by ordering layers from least to most frequently changing\n- Consider parallelization in build steps when possible\n- Set appropriate environment variables like NODE_ENV=production to optimize runtime behavior\n- Use appropriate healthchecks for the application type with the HEALTHCHECK instruction\n"},"import":{"commit_sha":"541b7819d8c3545c6df122491af4fa1eae415779","imported_at":"2026-05-18T20:05:35Z","license_text":"MIT License\n\nCopyright GitHub, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","owner":"github","repo":"github/awesome-copilot","source_url":"https://github.com/github/awesome-copilot/tree/541b7819d8c3545c6df122491af4fa1eae415779/plugins/devops-oncall/skills/multi-stage-dockerfile"}},"content_hash":[103,128,142,184,148,0,179,199,96,73,113,61,114,149,192,144,87,217,73,17,211,78,190,224,148,170,213,177,80,143,151,97],"trust_level":"unsigned","yanked":false}
