diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c32c7c8..69e5482 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,6 +28,11 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: nextcloud-dev-${{ matrix.container }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -58,12 +63,16 @@ jobs: with: push: false context: docker/ - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} file: ${{ steps.dockerfile.outputs.DOCKERFILE }} - tags: | - ghcr.io/juliushaertl/nextcloud-dev-${{ matrix.container }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new + outputs: type=image,name=nextcloud-dev-${{ matrix.container }},push-by-digest=true,name-canonical=true,push=true + - name: Build and push by digest + id: build + uses: docker/build-push-action@v5 + with: + context: . + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} - name: Export digest run: | mkdir -p /tmp/digests @@ -76,23 +85,6 @@ jobs: path: /tmp/digests/* if-no-files-found: error retention-days: 1 - - name: Push container image - uses: docker/build-push-action@v5 - if: github.ref == 'refs/heads/master' - with: - push: true - context: docker/ - platforms: linux/amd64,linux/arm64 - file: ${{ steps.dockerfile.outputs.DOCKERFILE }} - tags: | - ghcr.io/juliushaertl/nextcloud-dev-${{ matrix.container }}:${{ github.sha }} - ghcr.io/juliushaertl/nextcloud-dev-${{ matrix.container }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache merge: runs-on: ubuntu-latest @@ -114,7 +106,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.REGISTRY_IMAGE }} + images: nextcloud-dev-${{ matrix.container }} - name: Login to GitHub Container Registry if: needs.prepare.outputs.push == 'true' uses: docker/login-action@v3 @@ -129,6 +121,6 @@ jobs: $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - name: Inspect image run: | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} + docker buildx imagetools inspect ${{ steps.meta.outputs.name }} :${{ steps.meta.outputs.version }}