SP-180: Implement website analytics #31
Workflow file for this run
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: Build Docker image and scan for vulnerabilities | |
on: | |
pull_request: | |
branches: [ main ] | |
env: | |
IMAGE-NAME: maskinporten-onboarding-frontend | |
NODE_ENV: production | |
jobs: | |
build-scan-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set imagetag as env variable | |
run: echo "IMAGETAG=$(date +'%Y-%m-%d-%H%M')-${GITHUB_SHA::8}" >> "$GITHUB_ENV" | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Build image with Dockerfile | |
run: docker build -t ${{env.IMAGE-NAME}}:${{env.IMAGETAG}} --build-arg="BUILD_VERSION=${{env.IMAGETAG}}" . | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: ${{env.IMAGE-NAME}}:${{env.IMAGETAG}} | |
exit-code: '1' | |
severity: 'CRITICAL,HIGH' |