Skip to content

Commit 1dd6d28

Browse files
authored
Create snyk-container.yml
1 parent 20d2be7 commit 1dd6d28

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/snyk-container.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# A sample workflow which checks out the code, builds a container
7+
# image using Docker and scans that image for vulnerabilities using
8+
# Snyk. The results are then uploaded to GitHub Security Code Scanning
9+
#
10+
# For more examples, including how to limit scans to only high-severity
11+
# issues, monitor images for newly disclosed vulnerabilities in Snyk and
12+
# fail PR checks for new vulnerabilities, see https://github.com/snyk/actions/
13+
14+
name: Snyk Container
15+
16+
on:
17+
push:
18+
branches: [ "master" ]
19+
pull_request:
20+
# The branches below must be a subset of the branches above
21+
branches: [ "master" ]
22+
schedule:
23+
- cron: '19 11 * * 1'
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
snyk:
30+
permissions:
31+
contents: read # for actions/checkout to fetch code
32+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
33+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Build a Docker image
38+
run: docker build -t your/image-to-test .
39+
- name: Run Snyk to check Docker image for vulnerabilities
40+
# Snyk can be used to break the build when it detects vulnerabilities.
41+
# In this case we want to upload the issues to GitHub Code Scanning
42+
continue-on-error: true
43+
uses: snyk/actions/docker@14818c4695ecc4045f33c9cee9e795a788711ca4
44+
env:
45+
# In order to use the Snyk Action you will need to have a Snyk API token.
46+
# More details in https://github.com/snyk/actions#getting-your-snyk-token
47+
# or you can signup for free at https://snyk.io/login
48+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
49+
with:
50+
image: your/image-to-test
51+
args: --file=Dockerfile
52+
- name: Upload result to GitHub Code Scanning
53+
uses: github/codeql-action/upload-sarif@v2
54+
with:
55+
sarif_file: snyk.sarif

0 commit comments

Comments
 (0)