-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (44 loc) · 1.42 KB
/
snyk.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Snyk Scan
on:
workflow_call:
secrets:
SNYK_TOKEN:
required: true
inputs:
image_name:
description: 'The name of the docker image to build'
type: string
required: false
default: 'apache'
dockerfile_path:
description: 'The path of the Dockerfile'
type: string
required: false
default: './Dockerfile'
context:
description: 'The path of the directory that we are going to use as a context to build the image'
type: string
required: false
default: '.'
jobs:
snyk:
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Container image
run: docker build ${{ inputs.context }} --file ${{ inputs.dockerfile_path }} --tag ${{ inputs.image_name }}
- name: Run Snyk to check Docker image for vulnerabilities
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: ${{ inputs.image_name }}
args: --file=${{ inputs.dockerfile_path }}
# Push the Snyk Code results into GitHub Code Scanning tab
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: snyk.sarif