Update trivy workflow #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trivy Vulnerability Scan | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
scan: | |
name: Trivy Vulnerability Scan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Workaround: https://github.com/docker/build-push-action/issues/461 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 | |
# Build Docker image with Buildx | |
# https://github.com/docker/build-push-action | |
- name: Build and export Docker image | |
id: build-and-export | |
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 | |
with: | |
context: . | |
push: false | |
load: true | |
tags: 'pgschk/alpine-tookit:${{ github.sha }}' | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'pgschk/alpine-tookit:${{ github.sha }}' | |
format: 'table' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH,MEDIUM' |