본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

GitHub Actions로 로컬 레지스트리 사용하기

원문 보기 위키 갱신

GitHub Actions로 로컬 레지스트리 사용하기 (Local registry with GitHub Actions)

테스트 목적으로 이미지를 push할 로컬 레지스트리를 만들어야 할 수 있어요. GitHub Actions의 services로 로컬 레지스트리 컨테이너를 띄울 수 있어요.

출처: 문서

본문

다음 워크플로는 registry:3 이미지로 로컬 레지스트리를 서비스로 띄우고, 그곳으로 이미지를 빌드·push해요:

name: ci

on:
  push:

jobs:
  docker:
    runs-on: ubuntu-latest
    services:
      registry:
        image: registry:3
        ports:
          - 5000:5000
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v4
      
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4
        with:
          driver-opts: network=host
      
      - name: Build and push to local registry
        uses: docker/build-push-action@v7
        with:
          push: true
          tags: localhost:5000/name/app:latest
      
      - name: Inspect
        run: |
          docker buildx imagetools inspect localhost:5000/name/app:latest

driver-opts: network=host로 Buildx가 로컬 레지스트리(localhost:5000)에 접근할 수 있게 하고, imagetools inspect로 push된 매니페스트를 확인해요. 이 방식은 레지스트리 push 흐름을 실제 환경 없이 테스트할 때 유용해요.

더 알아보기 (Learn more)