3939 type=semver,pattern={{version}}
4040 type=semver,pattern={{major}}.{{minor}}
4141
42+ - name : Build an image from Dockerfile
43+ run : docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ github.sha }} . && docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:latest
44+
45+ - name : Run Trivy vulnerability scanner
46+ uses : aquasecurity/trivy-action@0.33.1
47+ with :
48+ image-ref : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ github.sha }}
49+ format : ' table'
50+ exit-code : ' 1'
51+ ignore-unfixed : true
52+ vuln-type : ' os,library'
53+ severity : ' CRITICAL,HIGH'
54+
55+
4256 - name : Log in to the Container registry
4357 if : github.event_name != 'pull_request'
4458 uses : docker/login-action@v3.3.0
@@ -47,14 +61,19 @@ jobs:
4761 username : ${{ github.actor }}
4862 password : ${{ secrets.GITHUB_TOKEN }}
4963
50- - name : Build and push Docker image
51- id : push
52- uses : docker/build-push-action@v5
53- with :
54- context : .
55- push : ${{ github.event_name != 'pull_request' }}
56- tags : ${{ steps.meta.outputs.tags }}
57- labels : ${{ steps.meta.outputs.labels }}
64+ - name : Tag metadata variants
65+ run : |
66+ while IFS= read -r tag; do
67+ docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ github.sha }} "$tag"
68+ done <<< "${{ steps.meta.outputs.tags }}"
69+
70+ - name : Push Docker image
71+ if : github.event_name != 'pull_request'
72+ run : |
73+ while IFS= read -r tag; do
74+ docker push "$tag"
75+ done <<< "${{ steps.meta.outputs.tags }}"
76+
5877
5978 - name : Generate artifact attestation
6079 uses : actions/attest-build-provenance@v1
0 commit comments