-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 1.6 KB
/
security.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
name: Security Checks
on:
push:
branches:
- master
pull_request:
branches:
- "*"
jobs:
build-image:
name: Docker Build
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
push: false
file: Dockerfile.prod
tags: tperich/curriculum_vitae:prod
outputs: type=docker,dest=/tmp/image.tar
- name: Upload Docker image
uses: actions/upload-artifact@v3
with:
name: docker-image
path: /tmp/image.tar
trivy-scan:
name: Trivy Scan
runs-on: ubuntu-latest
needs: build-image
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download Docker image
uses: actions/download-artifact@v3
with:
name: docker-image
path: /tmp
- name: Load Docker image
run: docker load -i /tmp/image.tar
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: image
image-ref: tperich/curriculum_vitae:prod
format: sarif
output: trivy-results.sarif
severity: CRITICAL,HIGH
exit-code: 1
- name: Upload Trivy results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: trivy-results.sarif