18
18
jobs :
19
19
build-docker :
20
20
runs-on :
21
- - self-hosted
22
- - Linux
23
- - ${{ matrix.runner }}
21
+ - codebuild-defguard-core-runner-${{ github.run_id }}-${{ github.run_attempt }}
22
+ image:${{ matrix.os }}
23
+ instance-size:${{ matrix.size }}
24
+
24
25
strategy :
25
26
matrix :
26
- # cpu: [arm64, amd64, arm/v7]
27
27
cpu : [arm64, amd64]
28
28
include :
29
- - cpu : arm64
30
- runner : ARM64
29
+ - os : arm-3.0
30
+ size : xlarge
31
+ cpu : arm64
31
32
tag : arm64
32
- - cpu : amd64
33
- runner : X64
33
+ - os : ubuntu-7.0
34
+ size : xlarge
35
+ cpu : amd64
34
36
tag : amd64
35
- # - cpu: arm/v7
36
- # runner: ARM
37
- # tag: armv7
37
+
38
+ permissions :
39
+ contents : read
40
+ packages : write
41
+
38
42
steps :
39
43
- name : Checkout
40
44
uses : actions/checkout@v4
41
45
with :
42
46
submodules : recursive
47
+
43
48
- name : Login to GitHub container registry
44
49
uses : docker/login-action@v3
45
50
with :
46
51
registry : ghcr.io
47
52
username : ${{ github.actor }}
48
53
password : ${{ secrets.GITHUB_TOKEN }}
54
+
49
55
- name : Set up Docker Buildx
50
56
uses : docker/setup-buildx-action@v3
51
- with :
52
- buildkitd-config-inline : |
53
- [registry."docker.io"]
54
- mirrors = ["dockerhub-proxy.teonite.net"]
57
+
55
58
- name : Build container
56
59
uses : docker/build-push-action@v6
57
60
with :
@@ -60,13 +63,35 @@ jobs:
60
63
provenance : false
61
64
push : true
62
65
tags : " ${{ env.GHCR_REPO }}:${{ github.sha }}-${{ matrix.tag }}"
63
- cache-from : type=gha
64
- cache-to : type=gha,mode=max
66
+ cache-from : |
67
+ type=registry,ref=${{ env.GHCR_REPO }}:cache-${{ matrix.tag }}
68
+ type=registry,ref=${{ env.GHCR_REPO }}:cache-${{ matrix.tag }}-${{ github.ref_name }}
69
+ cache-to : type=registry,mode=max,ref=${{ env.GHCR_REPO }}:cache-${{ matrix.tag }}-${{ github.ref_name }}
70
+
71
+ - name : Scan image with Trivy
72
+ uses :
aquasecurity/[email protected]
73
+ with :
74
+ image-ref : " ${{ env.GHCR_REPO }}:${{ github.sha }}-${{ matrix.tag }}"
75
+ format : " table"
76
+ exit-code : " 1"
77
+ ignore-unfixed : true
78
+ vuln-type : " os,library"
79
+ severity : " CRITICAL,HIGH,MEDIUM"
65
80
66
81
docker-manifest :
67
82
runs-on : [self-hosted, Linux]
83
+
84
+ permissions :
85
+ contents : read
86
+ packages : write
87
+ id-token : write # needed for signing the images with GitHub OIDC Token
88
+
68
89
needs : [build-docker]
90
+
69
91
steps :
92
+ - name : Install Cosign
93
+
94
+
70
95
- name : Docker meta
71
96
id : meta
72
97
uses : docker/metadata-action@v5
@@ -75,12 +100,14 @@ jobs:
75
100
${{ env.GHCR_REPO }}
76
101
flavor : ${{ inputs.flavor }}
77
102
tags : ${{ inputs.tags }}
103
+
78
104
- name : Login to GitHub container registry
79
105
uses : docker/login-action@v3
80
106
with :
81
107
registry : ghcr.io
82
108
username : ${{ github.actor }}
83
109
password : ${{ secrets.GITHUB_TOKEN }}
110
+
84
111
- name : Create and push manifests
85
112
run : |
86
113
tags='${{ env.GHCR_REPO }}:${{ github.sha }} ${{ steps.meta.outputs.tags }}'
@@ -90,4 +117,13 @@ jobs:
90
117
docker manifest create ${tag} ${{ env.GHCR_REPO }}:${{ github.sha }}-amd64 ${{ env.GHCR_REPO }}:${{ github.sha }}-arm64
91
118
docker manifest push ${tag}
92
119
done
93
- # ${{ env.GHCR_REPO }}:${{ github.sha }}-armv7
120
+
121
+ - name : Sign the images with GitHub OIDC Token
122
+ run : |
123
+ images='${{ env.GHCR_REPO }}:${{ github.sha }} ${{ steps.meta.outputs.tags }}'
124
+ cosign sign --yes ${images}
125
+
126
+ - name : Verify image signatures
127
+ run : |
128
+ images='${{ env.GHCR_REPO }}:${{ github.sha }} ${{ steps.meta.outputs.tags }}'
129
+ cosign verify ${images} --certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity-regexp="https://github.com/DefGuard/defguard" -o text
0 commit comments