-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (47 loc) · 1.4 KB
/
trivy-frontend.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
name: Scan Frontend with Trivy
on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
- develop
env:
IMAGE_NAME: frontend
VERSION: v1
jobs:
build_docker_image:
name: Build docker image
timeout-minutes: 15
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Build docker image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Log in to gHRC
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker tag $IMAGE_NAME ghcr.io/tivix/cpf/$IMAGE_NAME:$VERSION
docker push ghcr.io/tivix/cpf/$IMAGE_NAME:$VERSION
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: "ghcr.io/tivix/cpf/${{ env.IMAGE_NAME }}:${{ env.VERSION }}"
scanners: "vuln,secret,config"
format: "sarif"
output: "trivy-fe-results.sarif"
severity: "CRITICAL,HIGH"
- name: Upload scan result to Github Security
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-fe-results.sarif
category: "image"