Skip to content

Commit 627988e

Browse files
authored
Merge pull request #361 from aminya/docker-multiarch
Add multi-architecture Docker images for setup-cpp
2 parents 1b57bfb + 70694db commit 627988e

13 files changed

+147
-27
lines changed

.github/workflows/CI.yml

Lines changed: 135 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
if [[ "${{ github.ref_name }}" =~ ^refs/heads/ ]]; then
5555
git config user.name "github-actions[bot]"
5656
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
57-
57+
5858
git add dist/
5959
git commit -m "chore(build): update dist"
6060
git push
@@ -253,26 +253,46 @@ jobs:
253253
with:
254254
name: dist
255255

256+
- name: Define Platform Suffix
257+
id: platform
258+
run: |
259+
if [[ "${{ matrix.platform }}" == "linux/amd64" ]]; then
260+
echo "suffix=amd64" >> $GITHUB_OUTPUT
261+
else
262+
echo "suffix=arm64" >> $GITHUB_OUTPUT
263+
fi
264+
256265
- name: Login to Docker Hub
257266
uses: docker/login-action@v3
258-
if: ${{ github.event_name != 'pull_request' }}
267+
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
259268
with:
260269
username: aminya
261270
password: ${{ secrets.DOCKERHUB_TOKEN }}
262271

263272
- name: Build setup-cpp-${{matrix.container.distro }}
273+
id: build_base
264274
uses: docker/build-push-action@v6
265275
with:
266276
context: .
267277
file: ./dev/docker/ci/${{ matrix.container.distro }}.dockerfile
268-
push: ${{ github.event_name != 'pull_request' }}
278+
push: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
279+
load: true
280+
provenance: false
269281
platforms: ${{ matrix.platform }}
270-
tags: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}:latest
282+
tags: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
271283
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}:latest
272284
cache-to: type=inline
273285

286+
- name: Tag latest locally
287+
run: |
288+
docker tag aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}:latest
289+
290+
- name: Push latest to Docker Hub
291+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
292+
run: docker push aminya/${{ matrix.container.image }}:latest
293+
274294
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}
275-
if: ${{ github.event_name != 'pull_request' }}
295+
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
276296
uses: peter-evans/dockerhub-description@v4
277297
with:
278298
username: aminya
@@ -281,18 +301,29 @@ jobs:
281301
readme-filepath: ./README_DOCKER.md
282302

283303
- name: Build setup-cpp-${{matrix.container.distro }}-llvm
304+
id: build_llvm
284305
uses: docker/build-push-action@v6
285306
with:
286307
context: .
287308
file: ./dev/docker/ci/${{ matrix.container.distro }}-llvm.dockerfile
288-
push: ${{ github.event_name != 'pull_request' }}
309+
push: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
310+
load: true
311+
provenance: false
289312
platforms: ${{ matrix.platform }}
290-
tags: aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}-llvm:latest
313+
tags: aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
291314
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-llvm:latest
292315
cache-to: type=inline
293316

317+
- name: Tag latest locally
318+
run: |
319+
docker tag aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-llvm:latest
320+
321+
- name: Push latest to Docker Hub
322+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
323+
run: docker push aminya/${{ matrix.container.image }}-llvm:latest
324+
294325
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-llvm
295-
if: ${{ github.event_name != 'pull_request' }}
326+
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
296327
uses: peter-evans/dockerhub-description@v4
297328
with:
298329
username: aminya
@@ -311,18 +342,29 @@ jobs:
311342
tags: aminya/test-${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}
312343

313344
- name: Build setup-cpp-${{matrix.container.distro }}-gcc
345+
id: build_gcc
314346
uses: docker/build-push-action@v6
315347
with:
316348
context: .
317349
file: ./dev/docker/ci/${{ matrix.container.distro }}-gcc.dockerfile
318-
push: ${{ github.event_name != 'pull_request' }}
350+
push: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
351+
load: true
352+
provenance: false
319353
platforms: ${{ matrix.platform }}
320-
tags: aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}-gcc:latest
354+
tags: aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
321355
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-gcc:latest
322356
cache-to: type=inline
323357

358+
- name: Tag latest locally
359+
run: |
360+
docker tag aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-gcc:latest
361+
362+
- name: Push latest to Docker Hub
363+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
364+
run: docker push aminya/${{ matrix.container.image }}-gcc:latest
365+
324366
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-gcc
325-
if: ${{ github.event_name != 'pull_request' }}
367+
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
326368
uses: peter-evans/dockerhub-description@v4
327369
with:
328370
username: aminya
@@ -341,17 +383,29 @@ jobs:
341383
tags: aminya/test-${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}
342384

343385
- name: Build setup-cpp-${{matrix.container.distro }}-mingw
344-
if: ${{ !contains(matrix.container.distro, 'fedora') }}
386+
id: build_mingw
387+
if: ${{ matrix.container.distro != 'fedora' }}
345388
uses: docker/build-push-action@v6
346389
with:
347390
context: .
348391
file: ./dev/docker/ci/${{ matrix.container.distro }}-mingw.dockerfile
349-
push: ${{ github.event_name != 'pull_request' }}
392+
push: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
393+
load: true
394+
provenance: false
350395
platforms: ${{ matrix.platform }}
351-
tags: aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}-mingw:latest
396+
tags: aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
352397
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-mingw:latest
353398
cache-to: type=inline
354399

400+
- name: Tag latest locally
401+
if: ${{ matrix.container.distro != 'fedora' }}
402+
run: |
403+
docker tag aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-mingw:latest
404+
405+
- name: Push latest to Docker Hub
406+
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'fedora' }}
407+
run: docker push aminya/${{ matrix.container.image }}-mingw:latest
408+
355409
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-mingw
356410
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'fedora' }}
357411
uses: peter-evans/dockerhub-description@v4
@@ -362,7 +416,7 @@ jobs:
362416
readme-filepath: ./README_DOCKER.md
363417

364418
- name: Test Mingw
365-
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && !contains(matrix.container.distro, 'fedora') }}
419+
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && matrix.container.distro != 'fedora' }}
366420
uses: docker/build-push-action@v6
367421
with:
368422
context: .
@@ -371,6 +425,72 @@ jobs:
371425
platforms: ${{ matrix.platform }}
372426
tags: aminya/test-${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}
373427

428+
Docker-Manifest:
429+
needs: [Docker]
430+
runs-on: ubuntu-24.04
431+
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
432+
steps:
433+
- name: Set up Docker Buildx
434+
uses: docker/setup-buildx-action@v3
435+
436+
- name: Login to Docker Hub
437+
uses: docker/login-action@v3
438+
with:
439+
username: aminya
440+
password: ${{ secrets.DOCKERHUB_TOKEN }}
441+
442+
- uses: Noelware/[email protected]
443+
with:
444+
inputs: aminya/setup-cpp-ubuntu:22.04-1.1.1
445+
images: aminya/setup-cpp-ubuntu:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu:22.04-1.1.1-arm64
446+
push: true
447+
amend: true
448+
- uses: Noelware/[email protected]
449+
with:
450+
inputs: aminya/setup-cpp-ubuntu:latest
451+
images: aminya/setup-cpp-ubuntu:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu:22.04-1.1.1-arm64
452+
push: true
453+
amend: true
454+
455+
- uses: Noelware/[email protected]
456+
with:
457+
inputs: aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1
458+
images: aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-arm64
459+
push: true
460+
amend: true
461+
- uses: Noelware/[email protected]
462+
with:
463+
inputs: aminya/setup-cpp-ubuntu-llvm:latest
464+
images: aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-arm64
465+
push: true
466+
amend: true
467+
468+
- uses: Noelware/[email protected]
469+
with:
470+
inputs: aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1
471+
images: aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-arm64
472+
push: true
473+
amend: true
474+
- uses: Noelware/[email protected]
475+
with:
476+
inputs: aminya/setup-cpp-ubuntu-gcc:latest
477+
images: aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-arm64
478+
push: true
479+
amend: true
480+
481+
- uses: Noelware/[email protected]
482+
with:
483+
inputs: aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1
484+
images: aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-arm64
485+
push: true
486+
amend: true
487+
- uses: Noelware/[email protected]
488+
with:
489+
inputs: aminya/setup-cpp-ubuntu-mingw:latest
490+
images: aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-arm64
491+
push: true
492+
amend: true
493+
374494
Release:
375495
if: startsWith(github.ref, 'refs/tags/')
376496
needs: [Build, BuildExecutable, Test]

dev/docker/ci/arch-gcc.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM aminya/setup-cpp-arch:latest AS setup-cpp-arch-gcc
1+
FROM aminya/setup-cpp-arch:latest AS setup-cpp-arch-gcc
22

33
# install llvm
44
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \

dev/docker/ci/arch-llvm.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM aminya/setup-cpp-arch:latest AS setup-cpp-arch-llvm
1+
FROM aminya/setup-cpp-arch:latest AS setup-cpp-arch-llvm
22

33
# install llvm
44
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \

dev/docker/ci/arch-mingw.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM aminya/setup-cpp-arch:latest AS setup-cpp-arch-mingw
1+
FROM aminya/setup-cpp-arch:latest AS setup-cpp-arch-mingw
22

33
# install mingw/powershell
44
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \

dev/docker/ci/arch.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN pacman -Syuu --noconfirm && \
1313
rm -rf /var/cache/pacman/pkg/* && \
1414
rm -rf /tmp/*
1515

16-
FROM --platform=$BUILDPLATFORM arch-nodejs AS setup-cpp-arch
16+
FROM arch-nodejs AS setup-cpp-arch
1717

1818
COPY "./dist/modern" "/usr/lib/setup-cpp/"
1919

dev/docker/ci/fedora-gcc.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM aminya/setup-cpp-fedora:latest AS setup-cpp-fedora-gcc
1+
FROM aminya/setup-cpp-fedora:latest AS setup-cpp-fedora-gcc
22

33
# install gcc
44
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \

dev/docker/ci/fedora-llvm.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM aminya/setup-cpp-fedora:latest AS setup-cpp-fedora-llvm
1+
FROM aminya/setup-cpp-fedora:latest AS setup-cpp-fedora-llvm
22

33
# install llvm
44
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \

dev/docker/ci/fedora-mingw.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM aminya/setup-cpp-fedora:latest AS setup-cpp-fedora-mingw
1+
FROM aminya/setup-cpp-fedora:latest AS setup-cpp-fedora-mingw
22

33
# install mingw
44
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \

dev/docker/ci/fedora.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN dnf -y install nodejs npm && \
77
dnf clean all && \
88
rm -rf /tmp/*
99

10-
FROM --platform=$BUILDPLATFORM fedora-nodejs AS setup-cpp-fedora
10+
FROM fedora-nodejs AS setup-cpp-fedora
1111

1212
COPY "./dist/modern" "/usr/lib/setup-cpp/"
1313

dev/docker/ci/ubuntu-gcc.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM aminya/setup-cpp-ubuntu:latest AS setup-cpp-ubuntu-gcc
1+
FROM aminya/setup-cpp-ubuntu:latest AS setup-cpp-ubuntu-gcc
22

33
# install gcc
44
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \

0 commit comments

Comments
 (0)