Skip to content

Instantly share code, notes, and snippets.

@bramvdklinkenberg
Created June 29, 2021 20:54
Show Gist options
  • Save bramvdklinkenberg/881dbcad48f8a663b70f7b2a14d40ded to your computer and use it in GitHub Desktop.
Save bramvdklinkenberg/881dbcad48f8a663b70f7b2a14d40ded to your computer and use it in GitHub Desktop.
Github Action workflow for image scanning
################
## Dockerfile ##
################
FROM nginx:latest
COPY ./index.html /usr/share/nginx/html/index.html
################
## index.html ##
################
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Docker Nginx</title>
</head>
<body>
<h2>Scanning this Nginx image</h2>
</body>
</html>
###############################################
## .github/workflows/vulnerability-scan.yaml ##
###############################################
name: "Vulnerability Scan"
on:
push:
branches:
- main
jobs:
vulnerability_scan:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- run: docker build . -t testimage:${{ github.sha }}
name: docker build
- uses: Azure/container-scan@v0
name: scan image for vulnerabilities
# threshold levels are UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL
severity-threshold: MEDIUM
id: container_scan
# To fail the job when vulnerabilities are found, set to false
continue-on-error: true
with:
image-name: testimage:${{ github.sha }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment