Create trivyscan.yml #1
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 Scan | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
trivy_scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v2 | |
- name: Pull Docker image | |
run: docker pull my-python-app:latest | |
- name: Install Trivy | |
run: wget https://github.com/aquasecurity/trivy/releases/download/v0.35.0/trivy_0.35.0_Linux-64bit.deb && sudo dpkg -i trivy_0.35.0_Linux-64bit.deb | |
- name: Run Trivy Image Scan | |
run: trivy image my-python-app:latest --format json --output trivy-image-report.json | |
- name: Upload Trivy Image Report | |
uses: actions/upload-artifact@v2 | |
with: | |
name: trivy-image-report | |
path: trivy-image-report.json | |
- name: Run Trivy IaC Scan | |
run: trivy config --severity HIGH,CRITICAL . --format json --output trivy-iac-report.json | |
- name: Upload Trivy IaC Report | |
uses: actions/upload-artifact@v2 | |
with: | |
name: trivy-iac-report | |
path: trivy-iac-report.json |