8
8
branches :
9
9
- main
10
10
11
+ env :
12
+ IMAGE_NAME : podmortem-log-parser
13
+ DOCKERFILE : ./src/main/docker/Dockerfile.native
14
+ DEP_STAGE : dependencies
15
+
11
16
jobs :
12
17
warm-cache :
13
18
name : Warm Dependencies Cache
14
- runs-on : self-hosted
19
+ runs-on : [ self-hosted, linux]
15
20
permissions :
16
21
contents : read
17
22
packages : write
@@ -34,16 +39,16 @@ jobs:
34
39
uses : docker/build-push-action@v6
35
40
with :
36
41
context : .
37
- file : ./src/main/docker/Dockerfile.native
38
- target : dependencies
42
+ file : ${{ env.DOCKERFILE }}
43
+ target : ${{ env.DEP_STAGE }}
39
44
platforms : linux/amd64
40
45
push : ${{ github.event_name == 'push' }}
41
46
cache-from : type=gha,scope=deps
42
47
cache-to : |
43
48
type=gha,mode=max,scope=deps
44
- ${{ github.event_name == 'push' && format('type=registry,ref=ghcr.io/{0}/podmortem-log-parser :deps-cache,mode=max', github.repository_owner) || '' }}
49
+ ${{ github.event_name == 'push' && format('type=registry,ref=ghcr.io/{0}/{1} :deps-cache,mode=max', github.repository_owner, env.IMAGE_NAME ) || '' }}
45
50
tags : |
46
- ${{ github.event_name == 'push' && format('ghcr.io/{0}/podmortem-log-parser :deps-cache', github.repository_owner) || '' }}
51
+ ${{ github.event_name == 'push' && format('ghcr.io/{0}/{1} :deps-cache', github.repository_owner, env.IMAGE_NAME ) || '' }}
47
52
build-args : |
48
53
GITHUB_USER=${{ github.actor }}
49
54
secrets : |
53
58
name : Test Build
54
59
if : github.event_name == 'pull_request'
55
60
needs : warm-cache
56
- runs-on : self-hosted
61
+ runs-on : [ self-hosted, linux]
57
62
steps :
58
63
- name : Checkout repository
59
64
uses : actions/checkout@v4
65
70
uses : docker/build-push-action@v6
66
71
with :
67
72
context : .
68
- file : ./src/main/docker/Dockerfile.native
73
+ file : ${{ env.DOCKERFILE }}
69
74
platforms : linux/amd64
70
75
push : false
71
76
cache-from : |
@@ -81,18 +86,19 @@ jobs:
81
86
name : Build ${{ matrix.arch }}
82
87
if : github.event_name == 'push' && github.ref == 'refs/heads/main'
83
88
needs : warm-cache
84
- runs-on : self-hosted
89
+ runs-on : ${{ matrix.runner }}
85
90
permissions :
86
91
contents : read
87
92
packages : write
88
93
strategy :
89
94
matrix :
90
- arch : [amd64, arm64]
91
95
include :
92
96
- arch : amd64
93
97
platform : linux/amd64
98
+ runner : [self-hosted, linux]
94
99
- arch : arm64
95
100
platform : linux/arm64
101
+ runner : ubuntu-22.04-arm
96
102
steps :
97
103
- name : Checkout repository
98
104
uses : actions/checkout@v4
@@ -111,15 +117,15 @@ jobs:
111
117
uses : docker/build-push-action@v6
112
118
with :
113
119
context : .
114
- file : ./src/main/docker/Dockerfile.native
120
+ file : ${{ env.DOCKERFILE }}
115
121
platforms : ${{ matrix.platform }}
116
122
push : true
117
123
cache-from : |
118
124
type=gha,scope=deps
119
125
type=gha,scope=build-${{ matrix.arch }}
120
- cache-to : type=gha,mode=max,scope=build-${{ matrix.arch }}
126
+ cache-to : type=gha,mode=max,scope=build-amd64
121
127
tags : |
122
- ghcr.io/${{ github.repository_owner }}/podmortem-log-parser :${{ github.sha }}-${{ matrix.arch }}
128
+ ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} :${{ github.sha }}-${{ matrix.arch }}
123
129
build-args : |
124
130
GITHUB_USER=${{ github.actor }}
125
131
secrets : |
@@ -129,7 +135,7 @@ jobs:
129
135
name : Create Multi-Arch Manifest
130
136
if : github.event_name == 'push' && github.ref == 'refs/heads/main'
131
137
needs : build-arch
132
- runs-on : self-hosted
138
+ runs-on : [ self-hosted, linux]
133
139
permissions :
134
140
contents : read
135
141
packages : write
@@ -143,10 +149,10 @@ jobs:
143
149
144
150
- name : Create and push multi-arch manifest
145
151
run : |
146
- docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/podmortem-log-parser :latest \
147
- ghcr.io/${{ github.repository_owner }}/podmortem-log-parser :${{ github.sha }}-amd64 \
148
- ghcr.io/${{ github.repository_owner }}/podmortem-log-parser :${{ github.sha }}-arm64
152
+ docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} :latest \
153
+ ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} :${{ github.sha }}-amd64 \
154
+ ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} :${{ github.sha }}-arm64
149
155
150
- docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/podmortem-log-parser :${{ github.sha }} \
151
- ghcr.io/${{ github.repository_owner }}/podmortem-log-parser :${{ github.sha }}-amd64 \
152
- ghcr.io/${{ github.repository_owner }}/podmortem-log-parser :${{ github.sha }}-arm64
156
+ docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} :${{ github.sha }} \
157
+ ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} :${{ github.sha }}-amd64 \
158
+ ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} :${{ github.sha }}-arm64
0 commit comments