Skip to content

Update trivy-scan.yml to check locally #17

Update trivy-scan.yml to check locally

Update trivy-scan.yml to check locally #17

Workflow file for this run

name: Trivy Scan
on:
push:
branches:
- main
- 'release-1*'
- develop
- '1.2.*'
- master
- test
- MOSIP-35889
pull_request:
branches:
- main
- 'release-1*'
- develop
- '1.2.*'
- master
- test
- MOSIP-35889
jobs:
trivy-scan:
runs-on: ubuntu-latest
env:
SERVICE_NAME: partner-onboarder
VERSION: ${{ github.event.number || 'latest' }} # Use PR number for uniqueness, fallback to 'latest'
SERVICE_LOCATION: '.' # Set your service location if not root directory
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
run: |
cd "${{ env.SERVICE_LOCATION }}"
docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }}:${{ env.VERSION }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: '${{ env.SERVICE_NAME }}:${{ env.VERSION }}'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'