-
Notifications
You must be signed in to change notification settings - Fork 6
95 lines (76 loc) · 2.55 KB
/
trivy-test-images.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Trivy Docker Image Analysis
on:
push:
# Trigger manually
workflow_dispatch:
permissions:
security-events: write # To upload sarif files
jobs:
build-and-scan-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: '3.6.3'
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.7'
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./frontend/Dockerfile
push: false
tags: frontend:latest
load: true # Load the image into Docker's local image store
- name: Run Trivy Table
uses: aquasecurity/trivy-action@master
with:
scan-type: 'image'
image-ref: 'frontend:latest'
severity: 'MEDIUM,HIGH,CRITICAL'
format: 'table'
build-and-scan-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: '3.6.3'
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.7'
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
context: .
file: ./backend/Dockerfile
push: false
tags: backend:latest
load: true # Load the image into Docker's local image store
- name: Run Trivy Table
uses: aquasecurity/[email protected]
with:
scan-type: 'image'
image-ref: 'backend:latest'
severity: 'MEDIUM,HIGH,CRITICAL'
format: 'table'