From 903cb6c8b04f2c8ab1178241317af20fa69b35a2 Mon Sep 17 00:00:00 2001 From: Kalleby Santos <105971119+kallebysantos@users.noreply.github.com> Date: Tue, 21 Jan 2025 17:01:47 +0000 Subject: [PATCH] Update publish_docker.yml --- .github/workflows/publish_docker.yml | 59 ++++++++++------------------ 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml index 2d40446..c9e7b82 100644 --- a/.github/workflows/publish_docker.yml +++ b/.github/workflows/publish_docker.yml @@ -20,48 +20,31 @@ jobs: # Remove spaces to get the raw version string run: echo "result=$(sed -r 's/\s+//g' VERSION)" >> $GITHUB_OUTPUT - build_image: - needs: settings - strategy: - matrix: - include: - - runner: X64 - arch: amd64 - - runner: arm-runner - arch: arm64 - runs-on: ${{ matrix.runner }} - timeout-minutes: 180 - outputs: - image_digest: ${{ steps.build.outputs.digest }} - steps: - - run: docker context create builders - - uses: docker/setup-buildx-action@v3 - with: - endpoint: builders - - uses: docker/login-action@v2 + - name: Log in to Docker Hub + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - id: build - uses: docker/build-push-action@v5 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v2 + with: + images: kallebysantos/ocrlot + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v2 with: + context: . + file: ./Dockerfile push: true - tags: ${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }} - platforms: linux/${{ matrix.arch }} - cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.arch }} - cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.arch }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - merge_manifest: - needs: [settings, build_image] - runs-on: ubuntu-latest - steps: - - uses: docker/setup-buildx-action@v3 - - uses: docker/login-action@v2 + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Merge multi-arch manifests - run: | - docker buildx imagetools create -t ${{ needs.settings.outputs.image_tag }} \ - ${{ needs.settings.outputs.image_tag }}_amd64 \ - ${{ needs.settings.outputs.image_tag }}_arm64 + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true