-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.11 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Docker Image CI with Trivy Security Report
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE_TAG: ${{ github.run_id }}
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag name-convention-generator:${IMAGE_TAG}
- name: Set up Trivy
run: |
sudo apt-get update
sudo apt-get install -y wget
wget https://github.com/aquasecurity/trivy/releases/download/v0.40.0/trivy_0.40.0_Linux-64bit.deb
sudo dpkg -i trivy_0.40.0_Linux-64bit.deb
trivy --version
- name: Scan Docker image with Trivy and generate SARIF
run: |
mkdir -p trivy-reports
trivy image name-convention-generator:${IMAGE_TAG} \
--format sarif \
--output trivy-reports/trivy-report.sarif \
--severity HIGH,CRITICAL
- name: Upload SARIF file to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: trivy-reports/trivy-report.sarif