diff --git a/.github/workflows/build_docker_image.yml b/.github/workflows/build_docker_image.yml index af746b4..70d654c 100644 --- a/.github/workflows/build_docker_image.yml +++ b/.github/workflows/build_docker_image.yml @@ -8,6 +8,10 @@ on: branches: - "*" +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: build: name: build ((${{ matrix.platform}}) @@ -29,13 +33,18 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Github packages + - name: Login to the container registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: @@ -44,4 +53,5 @@ jobs: push: ${{ github.event_name != 'pull_request' }} build-args: | ARCH=${{ matrix.platform }} - tags: ${{ github.repository }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}