-
Notifications
You must be signed in to change notification settings - Fork 25
57 lines (49 loc) · 1.39 KB
/
grype.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
52
53
54
55
56
name: Docker Image Scan
on:
pull_request:
branches: [ main ]
paths:
- 'Dockerfile'
- 'docker-compose*.yml'
- '.docker/**'
jobs:
scan:
name: Build and Scan
runs-on: ubuntu-latest
environment: security
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Notify on failure
if: failure()
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ Container security scan failed. Please check the workflow logs.'
})
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build local container
uses: docker/build-push-action@v4
with:
tags: localbuild/testimage:latest
push: false
load: true
- name: Scan image
uses: anchore/scan-action@v3
with:
image: "localbuild/testimage:latest"
fail-build: true
severity-cutoff: high
- name: Upload scan results
uses: github/codeql-action/upload-sarif@v2
if: success() || failure()
with:
sarif_file: results.sarif