From f5e9ba68b2f72471606713b689fb54c1d239195c Mon Sep 17 00:00:00 2001 From: Dominik Pabst <963151+DoPaNik@users.noreply.github.com> Date: Sat, 11 Nov 2023 10:54:05 +0100 Subject: [PATCH] Add image build for pull requests --- .github/workflows/buildAndPushContainer.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/buildAndPushContainer.yml b/.github/workflows/buildAndPushContainer.yml index d401ae9..514ac03 100644 --- a/.github/workflows/buildAndPushContainer.yml +++ b/.github/workflows/buildAndPushContainer.yml @@ -32,6 +32,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push Docker image + if: ${{ github.event_name != 'pull_request' }} uses: docker/build-push-action@v2 with: context: ./supplychain/container/ @@ -44,12 +45,26 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max + - name: Build Docker image for pull request + if: ${{ github.event_name == 'pull_request' }} + uses: docker/build-push-action@v2 + with: + context: ./supplychain/container/ + file: ./supplychain/container/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ntdominikpabst/it-tage-ffm-2023-devops:${{ github.sha }}_PR${{ github.event.number }} + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Docker Scout id: docker-scout if: ${{ github.event_name == 'pull_request' }} uses: docker/scout-action@v1 with: command: quickview,cves,recommendations,sbom + image: ntdominikpabst/it-tage-ffm-2023-devops:${{ github.sha }}_PR${{ github.event.number }} to-latest: true ignore-base: true ignore-unchanged: true