Skip to content

Commit b071188

Browse files
ci: enhance container build workflow for ARM64 and slim images
1 parent 6bee7ef commit b071188

File tree

2 files changed

+58
-35
lines changed

2 files changed

+58
-35
lines changed

.github/workflows/build-container.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ on:
77
required: true
88
type: string
99
file:
10-
description: "Path to Dockerfile"
10+
description: "Path to main Dockerfile"
1111
required: true
1212
type: string
1313
name:
14-
description: "Container name"
14+
description: "Main container name"
15+
required: true
16+
type: string
17+
slim-file:
18+
description: "Path to slim Dockerfile"
19+
required: true
20+
type: string
21+
slim-name:
22+
description: "Slim container name"
1523
required: true
1624
type: string
1725
runs-on:
@@ -21,8 +29,11 @@ on:
2129
default: "ubuntu-24.04"
2230
outputs:
2331
path:
24-
description: "Path to built container"
32+
description: "Path to built main container"
2533
value: ghcr.io/${{ jobs.build.outputs.repo }}/${{ inputs.name }}:${{ jobs.build.outputs.tag }}
34+
slim-path:
35+
description: "Path to built slim container"
36+
value: ghcr.io/${{ jobs.build.outputs.repo }}/${{ inputs.slim-name }}:${{ jobs.build.outputs.tag }}
2637

2738
jobs:
2839
build:
@@ -55,7 +66,23 @@ jobs:
5566
username: ${{ github.actor }}
5667
password: ${{ secrets.GITHUB_TOKEN }}
5768

58-
- name: Build and push Docker image
69+
- name: Build and push SLIM Docker image
70+
uses: docker/build-push-action@v6
71+
with:
72+
context: ${{ inputs.context }}
73+
file: ${{ inputs.slim-file }}
74+
push: true
75+
tags: |
76+
ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ hashFiles(inputs.slim-file) }}
77+
ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ steps.prepare.outputs.tag }}
78+
ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:latest
79+
cache-from: |
80+
type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ hashFiles(inputs.slim-file) }}
81+
type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ steps.prepare.outputs.tag }}
82+
type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:latest
83+
cache-to: type=inline
84+
85+
- name: Build and push MAIN Docker image
5986
uses: docker/build-push-action@v6
6087
with:
6188
context: ${{ inputs.context }}

.github/workflows/build.yml

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,24 @@ concurrency:
1919

2020
jobs:
2121
container:
22-
name: Build container
22+
name: Build containers (amd64)
2323
uses: ./.github/workflows/build-container.yml
2424
with:
2525
context: ./contrib/containers/ci
2626
file: ./contrib/containers/ci/ci.Dockerfile
2727
name: dashcore-ci-runner
28-
29-
container-slim:
30-
name: Build slim container
31-
uses: ./.github/workflows/build-container.yml
32-
with:
33-
context: ./contrib/containers/ci
34-
file: ./contrib/containers/ci/ci-slim.Dockerfile
35-
name: dashcore-ci-slim
28+
slim-file: ./contrib/containers/ci/ci-slim.Dockerfile
29+
slim-name: dashcore-ci-slim
3630

3731
container-arm64:
38-
name: Build container (ARM64)
32+
name: Build containers (ARM64)
3933
uses: ./.github/workflows/build-container.yml
4034
with:
4135
context: ./contrib/containers/ci
4236
file: ./contrib/containers/ci/ci.Dockerfile
4337
name: dashcore-ci-runner
44-
runs-on: ubuntu-24.04-arm
45-
46-
container-slim-arm64:
47-
name: Build slim container (ARM64)
48-
uses: ./.github/workflows/build-container.yml
49-
with:
50-
context: ./contrib/containers/ci
51-
file: ./contrib/containers/ci/ci-slim.Dockerfile
52-
name: dashcore-ci-slim
38+
slim-file: ./contrib/containers/ci/ci-slim.Dockerfile
39+
slim-name: dashcore-ci-slim
5340
runs-on: ubuntu-24.04-arm
5441

5542
depends-arm-linux:
@@ -211,53 +198,62 @@ jobs:
211198
test-linux64:
212199
name: linux64-test
213200
uses: ./.github/workflows/test-src.yml
214-
needs: [container-slim, src-linux64]
201+
needs: [container, src-linux64]
215202
with:
216203
bundle-key: ${{ needs.src-linux64.outputs.key }}
217204
build-target: linux64
218-
container-path: ${{ needs.container-slim.outputs.path }}
205+
container-path: ${{ needs.container.outputs.slim-path }}
219206

220207
test-linux64_multiprocess:
221208
name: linux64_multiprocess-test
222209
uses: ./.github/workflows/test-src.yml
223-
needs: [container-slim, src-linux64_multiprocess]
210+
needs: [container, src-linux64_multiprocess]
224211
with:
225212
bundle-key: ${{ needs.src-linux64_multiprocess.outputs.key }}
226213
build-target: linux64_multiprocess
227-
container-path: ${{ needs.container-slim.outputs.path }}
214+
container-path: ${{ needs.container.outputs.slim-path }}
228215

229216
test-linux64_nowallet:
230217
name: linux64_nowallet-test
231218
uses: ./.github/workflows/test-src.yml
232-
needs: [container-slim, src-linux64_nowallet]
219+
needs: [container, src-linux64_nowallet]
233220
with:
234221
bundle-key: ${{ needs.src-linux64_nowallet.outputs.key }}
235222
build-target: linux64_nowallet
236-
container-path: ${{ needs.container-slim.outputs.path }}
223+
container-path: ${{ needs.container.outputs.slim-path }}
237224

238225
test-linux64_sqlite:
239226
name: linux64_sqlite-test
240227
uses: ./.github/workflows/test-src.yml
241-
needs: [container-slim, src-linux64_sqlite]
228+
needs: [container, src-linux64_sqlite]
242229
with:
243230
bundle-key: ${{ needs.src-linux64_sqlite.outputs.key }}
244231
build-target: linux64_sqlite
245-
container-path: ${{ needs.container-slim.outputs.path }}
232+
container-path: ${{ needs.container.outputs.slim-path }}
246233

247234
test-linux64_tsan:
248235
name: linux64_tsan-test
249236
uses: ./.github/workflows/test-src.yml
250-
needs: [container-slim, src-linux64_tsan]
237+
needs: [container, src-linux64_tsan]
251238
with:
252239
bundle-key: ${{ needs.src-linux64_tsan.outputs.key }}
253240
build-target: linux64_tsan
254-
container-path: ${{ needs.container-slim.outputs.path }}
241+
container-path: ${{ needs.container.outputs.slim-path }}
255242

256243
test-linux64_ubsan:
257244
name: linux64_ubsan-test
258245
uses: ./.github/workflows/test-src.yml
259-
needs: [container-slim, src-linux64_ubsan]
246+
needs: [container, src-linux64_ubsan]
260247
with:
261248
bundle-key: ${{ needs.src-linux64_ubsan.outputs.key }}
262249
build-target: linux64_ubsan
263-
container-path: ${{ needs.container-slim.outputs.path }}
250+
container-path: ${{ needs.container.outputs.slim-path }}
251+
252+
test-arm-linux:
253+
name: arm-linux-test
254+
uses: ./.github/workflows/test-src.yml
255+
needs: [container-arm64, src-arm-linux]
256+
with:
257+
bundle-key: ${{ needs.src-arm-linux.outputs.key }}
258+
build-target: arm-linux
259+
container-path: ${{ needs.container-arm64.outputs.slim-path }}

0 commit comments

Comments
 (0)