ci: copy image layers from ghcr to dockerhub on release (#16155)

This commit is contained in:
Zack Pollard 2025-02-17 14:41:45 +01:00 committed by GitHub
parent 425c87bce4
commit 924d11a913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -101,7 +101,6 @@ jobs:
context: machine-learning context: machine-learning
file: machine-learning/Dockerfile file: machine-learning/Dockerfile
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-machine-learning GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-machine-learning
DOCKER_REPO: altran1502/immich-machine-learning
strategy: strategy:
# Prevent a failure in one image from stopping the other builds # Prevent a failure in one image from stopping the other builds
fail-fast: false fail-fast: false
@ -142,14 +141,6 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.9.0 uses: docker/setup-buildx-action@v3.9.0
- name: Login to Docker Hub
# Only push to Docker Hub when making a release
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
# Skip when PR from a fork # Skip when PR from a fork
@ -169,7 +160,7 @@ jobs:
# Skip pushing when PR from a fork # Skip pushing when PR from a fork
push: ${{ !github.event.pull_request.head.repo.fork }} push: ${{ !github.event.pull_request.head.repo.fork }}
labels: ${{ steps.metadata.outputs.labels }} labels: ${{ steps.metadata.outputs.labels }}
outputs: type=image,"name=${{ env.GHCR_REPO }},${{ env.DOCKER_REPO }}",push-by-digest=true,name-canonical=true,push=true outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true
build-args: | build-args: |
DEVICE=${{ matrix.device }} DEVICE=${{ matrix.device }}
BUILD_ID=${{ github.run_id }} BUILD_ID=${{ github.run_id }}
@ -260,8 +251,7 @@ jobs:
working-directory: ${{ runner.temp }}/digests working-directory: ${{ runner.temp }}/digests
run: | run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *) \ $(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
$(printf '${{ env.DOCKER_REPO }}@sha256:%s ' *)
build_and_push_server: build_and_push_server:
name: Build and Push Server name: Build and Push Server
@ -273,7 +263,6 @@ jobs:
context: . context: .
file: server/Dockerfile file: server/Dockerfile
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-server GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-server
DOCKER_REPO: altran1502/immich-server
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -294,13 +283,6 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
# Skip when PR from a fork # Skip when PR from a fork
@ -320,7 +302,7 @@ jobs:
# Skip pushing when PR from a fork # Skip pushing when PR from a fork
push: ${{ !github.event.pull_request.head.repo.fork }} push: ${{ !github.event.pull_request.head.repo.fork }}
labels: ${{ steps.metadata.outputs.labels }} labels: ${{ steps.metadata.outputs.labels }}
outputs: type=image,"name=${{ env.GHCR_REPO }},${{ env.DOCKER_REPO }}",push-by-digest=true,name-canonical=true,push=true outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true
build-args: | build-args: |
DEVICE=cpu DEVICE=cpu
BUILD_ID=${{ github.run_id }} BUILD_ID=${{ github.run_id }}
@ -401,8 +383,7 @@ jobs:
working-directory: ${{ runner.temp }}/digests working-directory: ${{ runner.temp }}/digests
run: | run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *) \ $(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
$(printf '${{ env.DOCKER_REPO }}@sha256:%s ' *)
success-check-server: success-check-server:
name: Docker Build & Push Server Success name: Docker Build & Push Server Success