This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
64 lines (54 loc) · 2.07 KB
/
imageScan.yaml
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
name: ImageScan [Aqua Trivy]
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
permissions:
contents: read
jobs:
build:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
name: Build
runs-on: "ubuntu-18.04"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build an image from Dockerfile
run: |
cd src/backend/merger
docker build -t docker.io/my-organization/my-appm:${{ github.sha }} .
cd ../rotator
docker build -t docker.io/my-organization/my-appr:${{ github.sha }} .
cd ../../frontend
docker build -t docker.io/my-organization/my-appf:${{ github.sha }} .
- name: Run Trivy vulnerability scanner(backend-merger)
uses: aquasecurity/trivy-action@cb606dfdb0d2b3698ace62192088ef4f5360b24f
with:
image-ref: 'docker.io/my-organization/my-appm:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL'
- name: Run Trivy vulnerability scanner(backend-rotator)
uses: aquasecurity/trivy-action@cb606dfdb0d2b3698ace62192088ef4f5360b24f
with:
image-ref: 'docker.io/my-organization/my-appr:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL'
- name: Run Trivy vulnerability scanner(frontend)
uses: aquasecurity/trivy-action@cb606dfdb0d2b3698ace62192088ef4f5360b24f
with:
image-ref: 'docker.io/my-organization/my-appf:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'