Infra2025년 8월 15일2분 읽기

GitHub Actions에서 Docker 이미지 빌드 및 배포

YS
YoungSam
조회 1831

Docker 빌드 & 푸시

name: Build and Push
on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: docker/setup-buildx-action@v3
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - uses: docker/build-push-action@v5
        with:
          push: true
          tags: ghcr.io/${{ github.repository }}:latest
          cache-from: type=gha
          cache-to: type=gha,mode=max

레이어 캐싱으로 빌드 시간을 80% 단축할 수 있습니다.

GitHub ActionsDockerCI/CD

댓글 0

아직 댓글이 없습니다.