-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (99 loc) · 3.11 KB
/
redis-docker.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Build and Push Redis Image
on:
push:
branches:
- redis
- redis-tests
permissions:
contents: read
security-events: write
packages: write
jobs:
security-checks:
name: Security Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run GitGuardian scan
uses: GitGuardian/ggshield-action@master
env:
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
- name: Run Hadolint
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: ./Dockerfile
format: sarif
output-file: hadolint-results.sarif
no-fail: true
- name: Upload Hadolint results
uses: github/codeql-action/upload-sarif@v2
if: success() || failure()
with:
sarif_file: hadolint-results.sarif
category: hadolint
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
build-and-scan:
runs-on: ubuntu-latest
needs: security-checks
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and export
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: pbdco/aws-spotter:redis
cache-from: type=registry,ref=pbdco/aws-spotter:redis
cache-to: type=inline
outputs: type=docker,dest=/tmp/redis-image.tar
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: pbdco/aws-spotter:redis
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
timeout: '10m0s'
- name: Upload Trivy scan results
uses: github/codeql-action/upload-sarif@v2
if: success() || failure()
with:
sarif_file: trivy-results.sarif
category: trivy
- name: Run Docker Scout
if: success()
uses: docker/scout-action@v1
with:
command: quickview,cves
image: pbdco/aws-spotter:redis
only-severities: critical,high
exit-code: true
- name: Push image
uses: docker/build-push-action@v5
if: success()
with:
context: .
push: true
tags: pbdco/aws-spotter:redis
cache-from: type=registry,ref=pbdco/aws-spotter:redis
cache-to: type=inline