Skip to content

Trivy Docker Image Scanning #901

Trivy Docker Image Scanning

Trivy Docker Image Scanning #901

Workflow file for this run

name: Trivy Docker Image Scanning
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, reopened, synchronize]
schedule:
- cron: '0 0 * * *'
### Ensures that only one CI task per branch/environment will run at a time ###
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
trivy:
name: Trivy Scanning
runs-on: ubuntu-20.04
permissions:
security-events: write
actions: read
contents: read
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Build an image from Dockerfile
run: |
docker build -t dungpham91/lint-json-inside-yaml:${{ github.sha }} .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
with:
image-ref: 'dungpham91/lint-json-inside-yaml:${{ github.sha }}'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
if: always()
with:
sarif_file: 'trivy-results.sarif'
wait-for-processing: true