본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)40k · #7301

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/multi-stage-dockerfile/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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 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
자주 묻는 질문

Dockerfile은 무엇인가요?

Docker가 프로그램이 실행될 격리된 환경(컨테이너)을 만들도록 지시하는 명령이 적힌 텍스트 파일입니다.

'멀티 스테이지'가 왜 더 좋은가요?

프로그램을 '빌드'하는 도구와 '실행' 환경을 분리하기 때문에, 최종 컨테이너가 훨씬 작고 안전해집니다.

'컨테이너'는 무엇인가요?

프로그램이 실행하는 데 필요한 모든 것을 담은 격리된 상자와 같습니다. 덕분에 다른 컴퓨터에서도 쉽게 실행할 수 있습니다.

상세 정보

작성자의 원본 설명

Create optimized multi-stage Dockerfiles for any language or framework

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7301
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬