Skip to content

Commit 46e2885

Browse files
committed
feat(workflow): Add trivy scan step before pushing image to ghcr
1 parent 9b79bb5 commit 46e2885

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/build-release.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ jobs:
3232
- name: Set up Docker Buildx
3333
uses: docker/setup-buildx-action@v3
3434

35+
- name: Build backend Docker Image (Local)
36+
uses: docker/build-push-action@v6
37+
with:
38+
context: backend
39+
load: true
40+
tags: ${{ env.IMAGE_PREFIX }}-backend:${{ github.sha }}
41+
cache-from: type=gha
42+
cache-to: type=gha,mode=max
43+
44+
- name: Run Trivy vulnerability scanner
45+
uses: aquasecurity/trivy-action@v0.36.0
46+
with:
47+
image-ref: '${{ env.IMAGE_PREFIX }}-backend:${{ github.sha }}'
48+
exit-code: '1'
49+
ignore-unfixed: true
50+
severity: 'CRITICAL,HIGH'
51+
3552
- name: Build and Push backend Docker Image
3653
uses: docker/build-push-action@v6
3754
with:
@@ -81,6 +98,24 @@ jobs:
8198
- name: Set up Docker Buildx
8299
uses: docker/setup-buildx-action@v3
83100

101+
- name: Build frontend Docker Image (Local)
102+
uses: docker/build-push-action@v6
103+
with:
104+
context: frontend
105+
file: frontend/Dockerfile.actions
106+
load: true
107+
tags: ${{ env.IMAGE_PREFIX }}-frontend:${{ github.sha }}
108+
cache-from: type=gha
109+
cache-to: type=gha,mode=max
110+
111+
- name: Run Trivy vulnerability scanner
112+
uses: aquasecurity/trivy-action@v0.36.0
113+
with:
114+
image-ref: '${{ env.IMAGE_PREFIX }}-frontend:${{ github.sha }}'
115+
exit-code: '1'
116+
ignore-unfixed: true
117+
severity: 'CRITICAL,HIGH'
118+
84119
- name: Build and Push frontend Docker Image
85120
uses: docker/build-push-action@v6
86121
with:

0 commit comments

Comments
 (0)