multi-stage-dockerfile
하는 일
이 AI 에이전트는 컨테이너에서 프로그램을 실행하기 위한 효율적인 Dockerfile을 만드는 데 도움을 줍니다. 과정을 여러 단계로 나누어 최종 결과물이 더 작고, 더 안전하고, 더 빠르도록 합니다.
사용하는 경우
- ✓프로그램을 어디서든 실행할 수 있는 '패키지'를 만들고 싶을 때.
- ✓프로그램의 '패키지'를 가능한 한 작게 만들고 싶을 때.
- ✓프로그램의 '패키지'를 공격에 더 안전하게 만들고 싶을 때.
스킬 링크
https://github.com/github/awesome-copilot/blob/main/skills/multi-stage-dockerfile/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“React를 사용하는 Node.js 애플리케이션을 위한 최적화된 Dockerfile을 만들어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
'멀티 스테이지 빌드(multi-stage builds)'라는 기법을 사용합니다. 한 단계는 프로그램을 빌드하고, 다른 더 깔끔한 단계는 그것을 실행만 합니다. 이렇게 해서 꼭 필요한 것만 최종 결과물에 들어가도록 합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
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
- Organize commands to maximize layer caching
- Place commands that change frequently (like code changes) after commands that change less frequently (like dependency installation)
- Use
.dockerignoreto 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
USERinstruction 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
자주 묻는 질문
Dockerfile은 무엇인가요?
Docker가 프로그램이 실행될 격리된 환경(컨테이너)을 만들도록 지시하는 명령이 적힌 텍스트 파일입니다.
'멀티 스테이지'가 왜 더 좋은가요?
프로그램을 '빌드'하는 도구와 '실행' 환경을 분리하기 때문에, 최종 컨테이너가 훨씬 작고 안전해집니다.
'컨테이너'는 무엇인가요?
프로그램이 실행하는 데 필요한 모든 것을 담은 격리된 상자와 같습니다. 덕분에 다른 컴퓨터에서도 쉽게 실행할 수 있습니다.
상세 정보
작성자의 원본 설명
Create optimized multi-stage Dockerfiles for any language or framework
repo: github/awesome-copilot
인기도
- GitHub 스타
- 40k
- 순위
- #7301
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
acquire-codebase-knowledge
40k에이전트가 기존 코드 프로젝트를 이해하고 문서화하도록 돕습니다. 새 구성원을 맞이하거나 아키텍처를 개괄적으로 파악할 때 유용합니다.
acreadiness-assess
40k에이전트가 프로젝트의 AI 준비 상태를 평가하고 보고서를 만들도록 합니다. 프로젝트가 AI 도구를 쓸 준비가 얼마나 되어 있는지 이해하는 데 유용합니다.
acreadiness-generate-instructions
40k에이전트가 평가 결과를 바탕으로 AI 도구를 위한 지침을 만들도록 돕습니다. AI가 코드와 상호작용하는 방식을 개선하고 확인된 공백을 메울 때 유용합니다.
acreadiness-policy
40k에이전트가 AI 프로젝트 평가를 위한 정책을 정의하거나 적용하도록 돕습니다. 프로젝트 평가 방식을 표준화하고 규정 준수를 보장할 때 유용합니다.
비슷한 스킬
openclaw-update
394k에이전트가 설치 방식에 맞는 방법을 골라 기존 OpenClaw Gateway를 업데이트하고, 세션이 계속 작동하도록 돕습니다.
diagnose-gateway
394k에이전트가 설정, 채널, 포트를 확인해 OpenClaw Gateway가 왜 실패하는지 찾되, 아무것도 바꾸지 않도록 돕습니다.
crabbox-apps
394k에이전트가 임시 클라우드 머신에서 앱을 열고 실행한 뒤, 그 화면을 채팅의 측면 패널에 보여 주도록 돕습니다.