Add trivy scan

This commit is contained in:
Astound 2024-07-16 12:22:32 +08:00
parent 883d7e794e
commit cd5f00f541
Signed by: kaiser
GPG Key ID: 97504AF0027B1A56

View File

@ -30,7 +30,31 @@ jobs:
username: ${{ secrets.DOCKER_REGISTRY_USER }} username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Build and push - name: Build Docker image
id: build-image
uses: docker/build-push-action@v6
with:
context: gitolite-cgit
file: gitolite-cgit/Dockerfile
platforms: |
linux/amd64
linux/386
push: false
no-cache: true
tags: |
rusian/gitolite-cgit:latest
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: rusian/gitolite-cgit:latest
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os'
severity: 'CRITICAL,HIGH'
- name: Push Docker image
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: gitolite-cgit context: gitolite-cgit
@ -39,6 +63,6 @@ jobs:
linux/amd64 linux/amd64
linux/386 linux/386
push: true push: true
no-cache: true no-cache: false
tags: | tags: |
rusian/gitolite-cgit:latest rusian/gitolite-cgit:latest