Skip to content

Create docker-publish.yml #17

Create docker-publish.yml

Create docker-publish.yml #17

name: Scan Docker Image with Trivy
on:
push:
branches:
- main
jobs:
trivy_scan:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Prepare report file
run: touch trivy-image-report.txt
- name: Run Trivy vulnerability scanner on Docker image
uses: aquasecurity/trivy-action@master
with:
scan-type: 'image'
image-ref: 'ezio22/myazurefunctionapp:latest'
format: 'table'
exit-code: '1'
ignore-unfixed: false
severity: 'MEDIUM,HIGH,CRITICAL'
output: 'trivy-image-report.txt'
- name: Display Trivy scan results
run: |
if [ -s trivy-image-report.txt ]; then
cat trivy-image-report.txt
else
echo "Trivy report is empty."
fi
- name: Upload Trivy scan results
if: always()
uses: actions/upload-artifact@v2
with:
name: trivy-report
path: trivy-image-report.txt