-
Notifications
You must be signed in to change notification settings - Fork 7
43 lines (41 loc) · 1.37 KB
/
main.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
name: docker-nginx
on:
push:
tags:
- v*
jobs:
main:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- name: Checkout
uses: actions/checkout@v3
- name: Prepare docker buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
run: |
echo "${{ secrets.DOCKER_HUB_PASS }}" | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u ${{ github.actor }} --password-stdin ghcr.io
- name: Build Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: tivix/docker-nginx:${{ github.sha }}, tivix/docker-nginx:${{ env.CI_REF_NAME }}, ghcr.io/tivix/docker-nginx:${{ env.CI_REF_NAME }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: "tivix/docker-nginx:${{ github.sha }}"
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"
skip-dirs: /code/certs/
hide-progress: true