Created
June 29, 2021 20:54
-
-
Save bramvdklinkenberg/881dbcad48f8a663b70f7b2a14d40ded to your computer and use it in GitHub Desktop.
Github Action workflow for image scanning
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
################ | |
## Dockerfile ## | |
################ | |
FROM nginx:latest | |
COPY ./index.html /usr/share/nginx/html/index.html |
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
################ | |
## 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> |
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
############################################### | |
## .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