Skip to content

Commit 9021770

Browse files
committed
ci: [KAN-137] add trivy scan
1 parent bd69df5 commit 9021770

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/trivy.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build & Trivy Scan
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build-and-scan:
12+
runs-on: ubuntu-latest
13+
env:
14+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Build image
23+
run: |
24+
docker build -t "${DOCKER_HUB_USERNAME}/ceramicraft-user-mservice:${{ github.sha }}" server/
25+
26+
# scan and block if high severity vulnerabilities found
27+
- name: Run Trivy vulnerability scanner
28+
uses: aquasecurity/trivy-action@master
29+
with:
30+
image-ref: '${{ github.repository }}:${{ github.sha }}'
31+
format: 'table'
32+
severity: 'CRITICAL,HIGH'
33+
exit-code: '1' # non zero exit code if vulnerabilities found
34+
ignore-unfixed: true # ingnore unfixed vulnerabilities

0 commit comments

Comments
 (0)