refac: the whole Docker workflows (#7548)
Co-authored-by: DaanSelen <dselen@systemec.nl>
DaanSelen committed
Mar 5, 2026 at 10:41 UTC
f513f0b8a40f72668916709dc54533277903c1f4
5 files changed
+205
-503
.github/workflows/docker-alpine.yml
+78
-310
@@ -7,10 +7,14 @@ on:
7
release:
8
types: [ published ]
9
10
-jobs:
10
+permissions:
11
+ contents: read
12
+ packages: write
13
+ actions: write
14
12
- translate:
13
- runs-on: ubuntu-24.04
15
+jobs:
16
+ prepare:
17
+ runs-on: ubuntu-latest
18
name: Run Translations
19
steps:
20
- name: Checkout repository
@@ -18,7 +22,7 @@ jobs:
22
- name: Set up Node.js
23
uses: actions/setup-node@v6
24
with:
21
- node-version: "22.x"
25
+ node-version: "24.x"
26
- name: Run translate.js (ignore errors)
27
run: node translate.js || true
28
working-directory: translate
@@ -34,198 +38,52 @@ jobs:
38
- name: Upload repo with translations
39
uses: actions/upload-artifact@v5
40
with:
37
- name: repo-with-translations
38
- path: .
39
-
40
- build-amd64:
41
- runs-on: ubuntu-24.04
42
- needs: translate
43
- strategy:
44
- fail-fast: false
45
- matrix:
46
- variant: [mongodb, postgresql, mariadb, all, slim]
47
- name: Build Docker Image (amd64-${{ matrix.variant }})
48
- steps:
49
- - name: Download repo artifact
50
- uses: actions/download-artifact@v5
51
- with:
52
- name: repo-with-translations
53
- - name: Set up QEMU
54
- uses: docker/setup-qemu-action@v3
55
- with:
56
- cache-image: false
57
- platforms: amd64
58
- - name: Set up Docker Buildx
59
- uses: docker/setup-buildx-action@v3
60
- with:
61
- cache-binary: false
62
- - name: Log in to GitHub Container Registry
63
- uses: docker/login-action@v3
64
- with:
65
- registry: ghcr.io
66
- username: ${{ github.repository_owner }}
67
- password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
68
- - name: Build and push Docker image (amd64-${{ matrix.variant }})
69
- run: |
70
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
71
- case "${{ matrix.variant }}" in
72
- mongodb)
73
- MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-amd64-mongodb";;
74
- postgresql)
75
- MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-amd64-postgresql";;
76
- mariadb)
77
- MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-amd64-mariadb";;
78
- all)
79
- MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-amd64";;
80
- slim)
81
- MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-amd64-slim";;
82
- esac
83
- docker buildx build \
84
- --platform linux/amd64 \
85
- --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \
86
- --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \
87
- --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \
88
- --build-arg DISABLE_MINIFY=yes \
89
- --build-arg DISABLE_TRANSLATE=yes \
90
- --build-arg DISABLE_EXTRACT=yes \
91
- --build-arg PREINSTALL_LIBS=true \
92
- -f docker/Dockerfile \
93
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \
94
- --push \
95
- .
96
-
97
- build-arm64:
98
- runs-on: ubuntu-24.04-arm
99
- needs: translate
100
- strategy:
101
- fail-fast: false
102
- matrix:
103
- variant: [mongodb, postgresql, mariadb, all, slim]
104
- name: Build Docker Image (arm64-${{ matrix.variant }})
105
- steps:
106
- - name: Download repo artifact
107
- uses: actions/download-artifact@v5
108
- with:
109
- name: repo-with-translations
110
- - name: Set up QEMU
111
- uses: docker/setup-qemu-action@v3
112
- with:
113
- cache-image: false
114
- platforms: arm64
115
- - name: Set up Docker Buildx
116
- uses: docker/setup-buildx-action@v3
117
- with:
118
- cache-binary: false
119
- - name: Log in to GitHub Container Registry
120
- uses: docker/login-action@v3
121
- with:
122
- registry: ghcr.io
123
- username: ${{ github.repository_owner }}
124
- password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
125
- - name: Build and push Docker image (arm64-${{ matrix.variant }})
126
- run: |
127
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
128
- case "${{ matrix.variant }}" in
129
- mongodb)
130
- MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-arm64-mongodb";;
131
- postgresql)
132
- MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-arm64-postgresql";;
133
- mariadb)
134
- MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-arm64-mariadb";;
135
- all)
136
- MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-arm64";;
137
- slim)
138
- MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-arm64-slim";;
139
- esac
140
- docker buildx build \
141
- --platform linux/arm64 \
142
- --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \
143
- --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \
144
- --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \
145
- --build-arg DISABLE_MINIFY=yes \
146
- --build-arg DISABLE_TRANSLATE=yes \
147
- --build-arg DISABLE_EXTRACT=yes \
148
- --build-arg PREINSTALL_LIBS=true \
149
- -f docker/Dockerfile \
150
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \
151
- --push \
152
- .
153
-
154
- build-armv7:
155
- runs-on: ubuntu-24.04-arm
156
- needs: translate
157
- strategy:
158
- fail-fast: false
159
- matrix:
160
- variant: [mongodb, postgresql, mariadb, all, slim]
161
- name: Build Docker Image (armv7-${{ matrix.variant }})
162
- steps:
163
- - name: Download repo artifact
164
- uses: actions/download-artifact@v5
165
- with:
166
- name: repo-with-translations
167
- - name: Set up QEMU
168
- uses: docker/setup-qemu-action@v3
169
- with:
170
- cache-image: false
171
- platforms: arm
172
- - name: Set up Docker Buildx
173
- uses: docker/setup-buildx-action@v3
174
- with:
175
- cache-binary: false
176
- - name: Log in to GitHub Container Registry
177
- uses: docker/login-action@v3
178
- with:
179
- registry: ghcr.io
180
- username: ${{ github.repository_owner }}
181
- password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
182
- - name: Build and push Docker image (armv7-${{ matrix.variant }})
183
- run: |
184
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
185
- case "${{ matrix.variant }}" in
186
- mongodb)
187
- MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-armv7-mongodb";;
188
- postgresql)
189
- MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-armv7-postgresql";;
190
- mariadb)
191
- MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-armv7-mariadb";;
192
- all)
193
- MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-armv7";;
194
- slim)
195
- MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-armv7-slim";;
196
- esac
197
- docker buildx build \
198
- --platform linux/arm/v7 \
199
- --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \
200
- --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \
201
- --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \
202
- --build-arg DISABLE_MINIFY=yes \
203
- --build-arg DISABLE_TRANSLATE=yes \
204
- --build-arg DISABLE_EXTRACT=yes \
205
- --build-arg PREINSTALL_LIBS=true \
206
- -f docker/Dockerfile \
207
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \
208
- --push \
209
- .
210
-
211
- build-armv6:
212
- runs-on: ubuntu-24.04-arm
213
- needs: translate
41
+ name: repo-with-preparations
42
+ path: ./
43
+ build-images:
44
+ runs-on: ubuntu-latest
45
+ needs: prepare
46
strategy:
47
fail-fast: false
48
+ max-parallel: 5
49
matrix:
217
- variant: [mongodb, postgresql, mariadb, all, slim]
218
- name: Build Docker Image (armv6-${{ matrix.variant }})
50
+ include:
51
+ - variant: mongodb
52
+ suffix: -mongodb
53
+ postgresql: false
54
+ mongodb: true
55
+ mariadb: false
56
+ - variant: postgresql
57
+ suffix: -postgresql
58
+ postgresql: true
59
+ mongodb: false
60
+ mariadb: false
61
+ - variant: mariadb
62
+ suffix: -mariadb
63
+ postgresql: false
64
+ mongodb: false
65
+ mariadb: true
66
+ - variant: complete
67
+ suffix:
68
+ postgresql: true
69
+ mongodb: true
70
+ mariadb: true
71
+ - variant: slim
72
+ suffix: -slim
73
+ postgresql: false
74
+ mongodb: false
75
+ mariadb: false
76
+ name: Build Docker Image (${{ matrix.variant }})
77
steps:
78
- name: Download repo artifact
79
uses: actions/download-artifact@v5
80
with:
223
- name: repo-with-translations
81
+ name: repo-with-preparations
82
- name: Set up QEMU
83
uses: docker/setup-qemu-action@v3
84
with:
85
cache-image: false
228
- platforms: arm
86
+ platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
87
- name: Set up Docker Buildx
88
uses: docker/setup-buildx-action@v3
89
with:
@@ -236,129 +94,39 @@ jobs:
94
registry: ghcr.io
95
username: ${{ github.repository_owner }}
96
password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
239
- - name: Build and push Docker image (armv6-${{ matrix.variant }})
240
- run: |
241
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
242
- case "${{ matrix.variant }}" in
243
- mongodb)
244
- MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-armv6-mongodb";;
245
- postgresql)
246
- MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-armv6-postgresql";;
247
- mariadb)
248
- MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-armv6-mariadb";;
249
- all)
250
- MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-armv6";;
251
- slim)
252
- MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-armv6-slim";;
253
- esac
254
- docker buildx build \
255
- --platform linux/arm/v6 \
256
- --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \
257
- --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \
258
- --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \
259
- --build-arg DISABLE_MINIFY=yes \
260
- --build-arg DISABLE_TRANSLATE=yes \
261
- --build-arg DISABLE_EXTRACT=yes \
262
- --build-arg PREINSTALL_LIBS=true \
263
- -f docker/Dockerfile \
264
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \
265
- --push \
266
- .
267
-
268
- merge-manifest:
269
- runs-on: ubuntu-24.04-arm
270
- needs:
271
- - translate
272
- - build-amd64
273
- - build-arm64
274
- - build-armv7
275
- - build-armv6
276
- name: Create and Push Multi-Arch Manifest
97
+ - name: compile metadata information
98
+ id: meta
99
+ uses: docker/metadata-action@v5
100
+ with:
101
+ images: ghcr.io/${{ github.repository_owner }}/meshcentral
102
+ tags: |
103
+ type=ref,event=branch,suffix=${{ matrix.suffix }}
104
+ type=ref,event=tag,suffix=${{ matrix.suffix }}
105
+ type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant != 'complete'}},suffix=${{ matrix.suffix }}
106
+ type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant == 'complete'}}
107
+ - name: Build and push Docker image (${{ matrix.variant }}
108
+ uses: docker/build-push-action@v6
109
+ with:
110
+ push: ${{ github.event_name != 'pull_request' }}
111
+ context: .
112
+ file: ./docker/Dockerfile
113
+ tags: ${{ steps.meta.outputs.tags }}
114
+ labels: ${{ steps.meta.outputs.labels }}
115
+ platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
116
+ build-args: |
117
+ DISABLE_MINIFY=yes
118
+ DISABLE_TRANSLATE=yes
119
+ DISABLE_EXTRACT=yes
120
+ INCLUDE_MONGODB_TOOLS=${{ matrix.mongodb }}
121
+ INCLUDE_POSTGRESQL_TOOLS=${{ matrix.postgresql }}
122
+ INCLUDE_MARIADB_TOOLS=${{ matrix.mariadb }}
123
+ rerun-on-failure:
124
+ needs: build-images
125
+ if: failure() && fromJSON(github.run_attempt) < 3
126
+ runs-on: ubuntu-latest
127
steps:
278
- - name: Set up Docker Buildx
279
- uses: docker/setup-buildx-action@v3
280
- with:
281
- cache-binary: false
282
- - name: Log in to GitHub Container Registry
283
- uses: docker/login-action@v3
284
- with:
285
- registry: ghcr.io
286
- username: ${{ github.repository_owner }}
287
- password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
288
- - name: Create and push multi-arch manifests for all variants
289
- run: |
290
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
291
- # mongodb
292
- docker buildx imagetools create \
293
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-mongodb \
294
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mongodb \
295
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mongodb \
296
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-mongodb \
297
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-mongodb
298
- # postgresql
299
- docker buildx imagetools create \
300
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-postgresql \
301
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-postgresql \
302
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-postgresql \
303
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-postgresql \
304
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-postgresql
305
- # mariadb
306
- docker buildx imagetools create \
307
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-mariadb \
308
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mariadb \
309
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mariadb \
310
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-mariadb \
311
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-mariadb
312
- # all (no suffix)
313
- docker buildx imagetools create \
314
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }} \
315
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64 \
316
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64 \
317
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7 \
318
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6
319
- # slim
320
- docker buildx imagetools create \
321
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-slim \
322
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-slim \
323
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-slim \
324
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-slim \
325
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-slim
326
- - name: Create and push 'latest' tags (releases only)
327
- if: github.event_name == 'release'
328
- run: |
329
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
330
- # latest-mongodb
331
- docker buildx imagetools create \
332
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-mongodb \
333
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mongodb \
334
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mongodb \
335
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-mongodb \
336
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-mongodb
337
- # latest-postgresql
338
- docker buildx imagetools create \
339
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-postgresql \
340
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-postgresql \
341
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-postgresql \
342
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-postgresql \
343
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-postgresql
344
- # latest-mariadb
345
- docker buildx imagetools create \
346
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-mariadb \
347
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mariadb \
348
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mariadb \
349
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-mariadb \
350
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-mariadb
351
- # latest (all databases)
352
- docker buildx imagetools create \
353
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest \
354
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64 \
355
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64 \
356
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7 \
357
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6
358
- # latest-slim
359
- docker buildx imagetools create \
360
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-slim \
361
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-slim \
362
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-slim \
363
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7-slim \
364
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6-slim
128
+ - env:
129
+ GH_REPO: ${{ github.repository }}
130
+ GH_TOKEN: ${{ github.token }}
131
+ GH_DEBUG: api
132
+ run: gh workflow run rerun.yaml -r ${{ github.head_ref || github.ref_name }} -F run_id=${{ github.run_id }}
\ No newline at end of file
.github/workflows/docker-debian.yml
+78
-174
@@ -7,10 +7,14 @@ on:
7
release:
8
types: [ published ]
9
10
-jobs:
10
+permissions:
11
+ contents: read
12
+ packages: write
13
+ actions: write
14
12
- translate:
13
- runs-on: ubuntu-24.04
15
+jobs:
16
+ prepare:
17
+ runs-on: ubuntu-latest
18
name: Run Translations
19
steps:
20
- name: Checkout repository
@@ -18,7 +22,7 @@ jobs:
22
- name: Set up Node.js
23
uses: actions/setup-node@v6
24
with:
21
- node-version: "lts/*"
25
+ node-version: "24.x"
26
- name: Run translate.js (ignore errors)
27
run: node translate.js || true
28
working-directory: translate
@@ -34,28 +38,52 @@ jobs:
38
- name: Upload repo with translations
39
uses: actions/upload-artifact@v5
40
with:
37
- name: repo-with-translations
38
- path: .
39
-
40
- build-amd64:
41
- runs-on: ubuntu-24.04
42
- needs: translate
41
+ name: repo-with-preparations
42
+ path: ./
43
+ build-images:
44
+ runs-on: ubuntu-latest
45
+ needs: prepare
46
strategy:
47
fail-fast: false
45
- max-parallel: 3
48
+ max-parallel: 5
49
matrix:
47
- variant: [mongodb, postgresql, mariadb, all, slim]
48
- name: Build Docker Image (amd64-${{ matrix.variant }})
50
+ include:
51
+ - variant: mongodb
52
+ suffix: -mongodb-debian
53
+ postgresql: false
54
+ mongodb: true
55
+ mariadb: false
56
+ - variant: postgresql
57
+ suffix: -postgresql-debian
58
+ postgresql: true
59
+ mongodb: false
60
+ mariadb: false
61
+ - variant: mariadb
62
+ suffix: -mariadb-debian
63
+ postgresql: false
64
+ mongodb: false
65
+ mariadb: true
66
+ - variant: complete
67
+ suffix: -debian
68
+ postgresql: true
69
+ mongodb: true
70
+ mariadb: true
71
+ - variant: slim
72
+ suffix: -slim-debian
73
+ postgresql: false
74
+ mongodb: false
75
+ mariadb: false
76
+ name: Build Docker Image (${{ matrix.variant }})
77
steps:
78
- name: Download repo artifact
79
uses: actions/download-artifact@v5
80
with:
53
- name: repo-with-translations
81
+ name: repo-with-preparations
82
- name: Set up QEMU
83
uses: docker/setup-qemu-action@v3
84
with:
85
cache-image: false
58
- platforms: amd64
86
+ platforms: linux/amd64,linux/arm64,linux/arm/v7
87
- name: Set up Docker Buildx
88
uses: docker/setup-buildx-action@v3
89
with:
@@ -66,165 +94,41 @@ jobs:
94
registry: ghcr.io
95
username: ${{ github.repository_owner }}
96
password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
69
- - name: Build and push Docker image (amd64-${{ matrix.variant }})
70
- run: |
71
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
72
- case "${{ matrix.variant }}" in
73
- mongodb)
74
- MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-amd64-mongodb-debian";;
75
- postgresql)
76
- MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-amd64-postgresql-debian";;
77
- mariadb)
78
- MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-amd64-mariadb-debian";;
79
- all)
80
- MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-amd64-debian";;
81
- slim)
82
- MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-amd64-slim-debian";;
83
- esac
84
- docker buildx build \
85
- --platform linux/amd64 \
86
- --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \
87
- --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \
88
- --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \
89
- --build-arg DISABLE_MINIFY=yes \
90
- --build-arg DISABLE_TRANSLATE=yes \
91
- --build-arg DISABLE_EXTRACT=yes \
92
- --build-arg PREINSTALL_LIBS=true \
93
- -f docker/Dockerfile-debian \
94
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \
95
- --push \
96
- .
97
-
98
- build-arm64:
99
- runs-on: ubuntu-24.04-arm
100
- needs: translate
101
- strategy:
102
- fail-fast: false
103
- max-parallel: 3
104
- matrix:
105
- variant: [mongodb, postgresql, mariadb, all, slim]
106
- name: Build Docker Image (arm64-${{ matrix.variant }})
107
- steps:
108
- - name: Download repo artifact
109
- uses: actions/download-artifact@v5
110
- with:
111
- name: repo-with-translations
112
- - name: Set up QEMU
113
- uses: docker/setup-qemu-action@v3
114
- with:
115
- cache-image: false
116
- platforms: arm64
117
- - name: Set up Docker Buildx
118
- uses: docker/setup-buildx-action@v3
97
+ - name: compile metadata information
98
+ id: meta
99
+ uses: docker/metadata-action@v5
100
with:
120
- cache-binary: false
121
- - name: Log in to GitHub Container Registry
122
- uses: docker/login-action@v3
101
+ images: ghcr.io/${{ github.repository_owner }}/meshcentral
102
+ flavor: |
103
+ latest=false
104
+ tags: |
105
+ type=ref,event=branch,suffix=${{ matrix.suffix }}
106
+ type=ref,event=tag,suffix=${{ matrix.suffix }}
107
+ type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant != 'complete'}},suffix=${{ matrix.suffix }}
108
+ type=raw,value=latest-debian,enable=${{startsWith(github.ref, 'refs/tags/') && matrix.variant == 'complete'}}
109
+ - name: Build and push Docker image (${{ matrix.variant }}
110
+ uses: docker/build-push-action@v6
111
with:
124
- registry: ghcr.io
125
- username: ${{ github.repository_owner }}
126
- password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
127
- - name: Build and push Docker image (arm64-${{ matrix.variant }})
128
- run: |
129
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
130
- case "${{ matrix.variant }}" in
131
- mongodb)
132
- MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-arm64-mongodb-debian";;
133
- postgresql)
134
- MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-arm64-postgresql-debian";;
135
- mariadb)
136
- MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-arm64-mariadb-debian";;
137
- all)
138
- MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-arm64-debian";;
139
- slim)
140
- MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-arm64-slim-debian";;
141
- esac
142
- docker buildx build \
143
- --platform linux/arm64 \
144
- --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \
145
- --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \
146
- --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \
147
- --build-arg DISABLE_MINIFY=yes \
148
- --build-arg DISABLE_TRANSLATE=yes \
149
- --build-arg DISABLE_EXTRACT=yes \
150
- --build-arg PREINSTALL_LIBS=true \
151
- -f docker/Dockerfile-debian \
152
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \
153
- --push \
154
- .
155
-
156
- merge-manifest:
157
- runs-on: ubuntu-24.04
158
- needs:
159
- - translate
160
- - build-amd64
161
- - build-arm64
162
- name: Create and Push Multi-Arch Manifest
112
+ push: ${{ github.event_name != 'pull_request' }}
113
+ context: .
114
+ file: ./docker/Dockerfile-debian
115
+ tags: ${{ steps.meta.outputs.tags }}
116
+ labels: ${{ steps.meta.outputs.labels }}
117
+ platforms: linux/amd64,linux/arm64,linux/arm/v7
118
+ build-args: |
119
+ DISABLE_MINIFY=yes
120
+ DISABLE_TRANSLATE=yes
121
+ DISABLE_EXTRACT=yes
122
+ INCLUDE_MONGODB_TOOLS=${{ matrix.mongodb }}
123
+ INCLUDE_POSTGRESQL_TOOLS=${{ matrix.postgresql }}
124
+ INCLUDE_MARIADB_TOOLS=${{ matrix.mariadb }}
125
+ rerun-on-failure:
126
+ needs: build-images
127
+ if: failure() && fromJSON(github.run_attempt) < 3
128
+ runs-on: ubuntu-latest
129
steps:
164
- - name: Set up Docker Buildx
165
- uses: docker/setup-buildx-action@v3
166
- with:
167
- cache-binary: false
168
- - name: Log in to GitHub Container Registry
169
- uses: docker/login-action@v3
170
- with:
171
- registry: ghcr.io
172
- username: ${{ github.repository_owner }}
173
- password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}
174
- - name: Create and push multi-arch manifests for all variants
175
- run: |
176
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
177
- # mongodb
178
- docker buildx imagetools create \
179
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-mongodb-debian \
180
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mongodb-debian \
181
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mongodb-debian \
182
- # postgresql
183
- docker buildx imagetools create \
184
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-postgresql-debian \
185
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-postgresql-debian \
186
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-postgresql-debian \
187
- # mariadb
188
- docker buildx imagetools create \
189
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-mariadb-debian \
190
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mariadb-debian \
191
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mariadb-debian \
192
- # all (no suffix)
193
- docker buildx imagetools create \
194
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-debian \
195
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-debian \
196
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-debian \
197
- # slim
198
- docker buildx imagetools create \
199
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-slim-debian \
200
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-slim-debian \
201
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-slim-debian \
202
- - name: Create and push 'latest' tags (releases only)
203
- if: github.event_name == 'release'
204
- run: |
205
- REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
206
- # latest-mongodb
207
- docker buildx imagetools create \
208
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-mongodb-debian \
209
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mongodb-debian \
210
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mongodb-debian \
211
- # latest-postgresql
212
- docker buildx imagetools create \
213
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-postgresql-debian \
214
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-postgresql-debian \
215
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-postgresql-debian \
216
- # latest-mariadb
217
- docker buildx imagetools create \
218
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-mariadb-debian \
219
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mariadb-debian \
220
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mariadb-debian \
221
- # latest (all databases)
222
- docker buildx imagetools create \
223
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-debian \
224
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-debian \
225
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-debian \
226
- # latest-slim
227
- docker buildx imagetools create \
228
- -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-slim-debian \
229
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-slim-debian \
230
- ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-slim-debian \
130
+ - env:
131
+ GH_REPO: ${{ github.repository }}
132
+ GH_TOKEN: ${{ github.token }}
133
+ GH_DEBUG: api
134
+ run: gh workflow run rerun.yaml -r ${{ github.head_ref || github.ref_name }} -F run_id=${{ github.run_id }}
.github/workflows/rerun.yaml
new
+19
@@ -0,0 +1,19 @@
1
+name: Rerun failed workflow
2
+
3
+on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ run_id:
7
+ required: true
8
+jobs:
9
+ rerun:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: rerun ${{ inputs.run_id }}
13
+ env:
14
+ GH_REPO: ${{ github.repository }}
15
+ GH_TOKEN: ${{ github.token }}
16
+ GH_DEBUG: api
17
+ run: |
18
+ gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
19
+ gh run rerun ${{ inputs.run_id }} --failed
\ No newline at end of file
docker/Dockerfile
+11
-10
@@ -1,5 +1,5 @@
1
### STAGE 1 BUILDING.
2
-FROM node:22-alpine3.22 AS builder
2
+FROM alpine:3.23 AS builder
3
4
# Any value inside one of the disable ARGs will be accepted.
5
ARG DISABLE_EXTRACT="yes"
@@ -8,7 +8,9 @@ ARG DISABLE_TRANSLATE="yes"
8
# NODE_OPTIONS="--max_old_space_size=4096"
9
# If your process gets OOM killed, perhaps the above will help.
10
11
-RUN mkdir -p /opt/meshcentral/meshcentral
11
+RUN apk add --no-cache --update \
12
+ nodejs npm; \
13
+ mkdir -p /opt/meshcentral/meshcentral
14
WORKDIR /opt/meshcentral
15
COPY ./ /opt/meshcentral/meshcentral/
16
@@ -47,11 +49,11 @@ RUN rm -rf /opt/meshcentral/meshcentral/docker /opt/meshcentral/meshcentral/node
49
50
### STAGE 2 PRECOMPILE DEPS MODULE
51
50
-FROM node:22-alpine3.22 AS dep-compiler
52
+FROM alpine:3.23 AS dep-compiler
53
54
RUN echo -e "----------\nINSTALLING ALPINE PACKAGES...\n----------"; \
55
apk add --no-cache --update \
54
- bash gcc g++ jq make python3 tzdata
56
+ bash gcc g++ jq make nodejs npm python3 tzdata
57
58
COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
59
WORKDIR /opt/meshcentral/meshcentral
@@ -63,8 +65,7 @@ RUN jq '.dependencies += {"modern-syslog": "1.2.0", "telegram": "2.26.22"}' pack
65
66
### STAGE 3 BUILDING.
67
66
-FROM node:22-alpine3.22 AS finalizer
67
-#FROM alpine:3.22 AS finalizer
68
+FROM alpine:3.23 AS finalizer
69
70
# copy files from previous layer
71
COPY --from=dep-compiler /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
@@ -127,12 +128,10 @@ ENV MARIADB_HOST="" \
128
MARIADB_PASS="" \
129
MARIADB_DATABASE=""
130
130
-RUN mkdir -p /opt/meshcentral/meshcentral
131
-WORKDIR /opt/meshcentral
132
-
131
RUN echo -e "----------\nINSTALLING ALPINE PACKAGES...\n----------"; \
132
+ mkdir -p /opt/meshcentral/meshcentral; \
133
apk add --no-cache --update \
135
- bash curl jq tzdata && \
134
+ bash curl jq nodejs npm tzdata && \
135
rm -rf /var/cache/* \
136
/tmp/* \
137
/usr/share/man/ \
@@ -142,6 +141,8 @@ RUN echo -e "----------\nINSTALLING ALPINE PACKAGES...\n----------"; \
141
/usr/lib/debug/ && \
142
npm install -g npm@latest
143
144
+WORKDIR /opt/meshcentral
145
+
146
RUN case "$PREINSTALL_LIBS" in \
147
true|yes|TRUE|YES) \
148
cd meshcentral && \
docker/Dockerfile-debian
+19
-9
@@ -1,5 +1,5 @@
1
### STAGE 1 BUILDING.
2
-FROM node:22-trixie-slim AS builder
2
+FROM debian:trixie-slim AS builder
3
4
# Any value inside one of the disable ARGs will be accepted.
5
ARG DISABLE_EXTRACT="yes"
@@ -8,7 +8,13 @@ ARG DISABLE_TRANSLATE="yes"
8
# NODE_OPTIONS="--max_old_space_size=4096"
9
# If your process gets OOM killed, perhaps the above will help.
10
11
-RUN mkdir -p /opt/meshcentral/meshcentral
11
+# Install nodesource's NodeJS
12
+RUN apt-get update && \
13
+ apt-get install -y --no-install-recommends --no-install-suggests \
14
+ nodejs npm && \
15
+ npm install -g npm@latest && \
16
+ mkdir -p /opt/meshcentral/meshcentral
17
+
18
WORKDIR /opt/meshcentral
19
COPY ./ /opt/meshcentral/meshcentral/
20
@@ -47,14 +53,16 @@ RUN rm -rf /opt/meshcentral/meshcentral/docker /opt/meshcentral/meshcentral/node
53
54
### STAGE 2 PRECOMPILE DEPS MODULE
55
50
-FROM node:22-trixie-slim AS dep-compiler
56
+FROM debian:trixie-slim AS dep-compiler
57
58
ENV NODE_ENV="production"
59
60
+# Install general dependencies and nodesource's NodeJS
61
RUN apt-get update && \
62
echo -e "----------\nINSTALLING DEBIAN PACKAGES...\n----------"; \
63
apt-get install -y --no-install-recommends --no-install-suggests \
57
- bash gcc g++ jq make python3 tzdata
64
+ bash gcc g++ jq make nodejs npm python3 tzdata && \
65
+ npm install -g npm@latest
66
67
COPY --from=builder /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
68
WORKDIR /opt/meshcentral/meshcentral
@@ -89,7 +97,9 @@ RUN case "$INCLUDE_MONGODB_TOOLS" in \
97
98
### STAGE 4 BUILDING.
99
92
-FROM node:22-trixie-slim AS finalizer
100
+FROM debian:trixie-slim AS finalizer
101
+
102
+ARG NODEJS_DOWNLOAD="https://nodejs.org/dist/v24.12.0/node-v24.12.0-linux-x64.tar.xz"
103
104
# Copy files from previous layers
105
COPY --from=dep-compiler /opt/meshcentral/meshcentral /opt/meshcentral/meshcentral
@@ -158,16 +168,16 @@ WORKDIR /opt/meshcentral
168
RUN apt-get update && \
169
echo -e "----------\nINSTALLING DEBIAN PACKAGES...\n----------"; \
170
apt-get install -y --no-install-recommends --no-install-suggests \
161
- bash curl jq tzdata && \
162
- rm -rf \
171
+ bash ca-certificates curl jq nodejs npm tzdata && \
172
+ npm install -g npm@latest && \
173
+ rm -rfv \
174
/var/cache/* \
175
/usr/share/man/ \
176
/usr/share/doc/ \
177
/var/log/* \
178
/var/spool/* \
179
/var/tmp/* \
169
- /usr/lib/debug/ && \
170
- npm install -g npm@latest
180
+ /usr/lib/debug/
181
182
RUN case "$PREINSTALL_LIBS" in \
183
true|yes|TRUE|YES) \