Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan docker image after build for security vulnerabilities #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,41 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

image-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and Export to Docker
uses: docker/build-push-action@v3
with:
context: .
tags: gui:latest
outputs: type=docker,dest=/tmp/gui.tar

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: gui:latest
format: sarif
output: trivy-results.sarif
severity: 'CRITICAL,HIGH'

- name: Upload GUI Image
uses: actions/upload-artifact@v3
with:
name: gui-image
path: /tmp/gui.tar
retention-days: 5

release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: test
needs:
- test
- image-scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -60,6 +91,18 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Download GUI Image
uses: actions/download-artifact@v3
with:
name: gui-image
path: /tmp

- name: Load GUI Image
run: docker load --input /tmp/gui.tar

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
Expand Down