This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
Trivy Docker Image Analysis #52
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 Docker Image Analysis | |
on: | |
push: | |
branches: | |
- main | |
# Trigger manually | |
workflow_dispatch: | |
permissions: | |
security-events: write # To upload sarif files | |
jobs: | |
build-and-scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: '3.6.3' | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.7' | |
# Workaround: https://github.com/docker/build-push-action/issues/461 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb | |
# Build and push Docker image with Buildx (don't push on PR) | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: false | |
tags: backend:latest | |
load: true # Load the image into Docker's local image store | |
- name: Run Trivy Table | |
uses: aquasecurity/[email protected] | |
with: | |
scan-type: 'image' | |
image-ref: 'backend:latest' | |
severity: 'MEDIUM,HIGH,CRITICAL' | |
format: 'table' | |