Skip to content

Commit b6e5704

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

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
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: "${{ env.DOCKER_HUB_USERNAME }}/ceramicraft-user-mservice:${{ 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

server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use the official Go image with version 1.24
2-
FROM golang:1.24.0-alpine AS builder
2+
FROM golang:1.24.6-alpine AS builder
33

44
# Set the working directory inside the container
55
WORKDIR /app

0 commit comments

Comments
 (0)