Trivy Scan for Public Image #20
This file contains hidden or 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 for Public Image | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| jobs: | |
| pull-image: | |
| name: Pull Docker Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Pull Alpine Image | |
| run: docker pull alpine:3.20 | |
| scan: | |
| name: Scan Docker Image with Trivy | |
| runs-on: ubuntu-latest | |
| needs: pull-image | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@0.28.0 | |
| with: | |
| scan-type: image-ref | |
| image-ref: alpine:3.20 | |
| format: sarif | |
| output: trivy-results.sarif | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: trivy-results.sarif |