Skip to content

Commit 7d7df6a

Browse files
authored
fix(ci): scan local image instead of pulling (#215)
Co-authored-by: Dan Barr <[email protected]>
1 parent 56e25bc commit 7d7df6a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/build-containers.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,17 @@ jobs:
377377
sbom: true
378378
provenance: true
379379

380+
- name: Build single-platform image for Trivy scan
381+
id: build-for-scan
382+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
383+
with:
384+
context: ${{ steps.dockerfile.outputs.dockerfile_dir }}
385+
file: ${{ steps.dockerfile.outputs.dockerfile_path }}
386+
platforms: linux/amd64
387+
load: true
388+
tags: local-scan:${{ steps.meta.outputs.server_name }}-${{ steps.meta.outputs.version }}
389+
cache-from: type=gha
390+
380391
- name: Sign container images with Cosign
381392
if: github.event_name != 'pull_request'
382393
env:
@@ -450,7 +461,7 @@ jobs:
450461
- name: Run Trivy vulnerability scanner
451462
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # 0.33.1
452463
with:
453-
image-ref: ${{ steps.meta.outputs.image_name }}:${{ steps.meta.outputs.version }}
464+
image-ref: local-scan:${{ steps.meta.outputs.server_name }}-${{ steps.meta.outputs.version }}
454465
format: 'sarif'
455466
output: 'trivy-results.sarif'
456467
severity: 'CRITICAL,HIGH,MEDIUM'

0 commit comments

Comments
 (0)