-
Notifications
You must be signed in to change notification settings - Fork 3
49 lines (47 loc) · 1.44 KB
/
docker.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
name: docker-images
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
jobs:
build-docker:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v4
- run: make docker
- name: Run Trivy vulnerability scanner (table output)
uses: aquasecurity/trivy-action@master
with:
image-ref: grafana/smtprelay
format: table
exit-code: 1
ignore-unfixed: true
vuln-type: os,library
severity: CRITICAL,HIGH
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: grafana/smtprelay
format: sarif
output: trivy-results.sarif
ignore-unfixed: true
vuln-type: os,library
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
if: always() && github.repository == 'grafana/smtprelay'
- name: Log in to Docker Hub (on tags only)
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push images to Docker Hub (on tags only)
if: startsWith(github.ref, 'refs/tags/v')
run: make docker-push