Skip to content

Commit a416657

Browse files
committed
github: Build the whole multiplatform docker image with Dockerfile.toolchain
This makes the docker image contain a PGO optimized compiler, without needing to redo all of the PGO build stages in docker. This reverts commit 8f42112, and fixes building the multiplatform image in a simpler way. Instead of doing two separate builds, with separate Dockerfiles, just do one multiplatform build of one Dockerfile, which docker runs serially, for each one of the included architectures, just packaging the prebuilt toolchains in the docker image.
1 parent 8f69f74 commit a416657

File tree

1 file changed

+5
-44
lines changed

1 file changed

+5
-44
lines changed

.github/workflows/docker.yml

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,11 @@ jobs:
6464
docker-build:
6565
needs: [prepare]
6666
runs-on: ubuntu-latest
67-
strategy:
68-
fail-fast: false
69-
matrix:
70-
include:
71-
- { file: Dockerfile, key: amd64 }
72-
- { file: Dockerfile.toolchain, platforms: linux/arm64, key: arm64 }
7367
steps:
7468
- uses: actions/checkout@v4
7569
with:
7670
ref: ${{inputs.ref}}
7771
- name: Download toolchain
78-
if: ${{matrix.file == 'Dockerfile.toolchain'}}
7972
uses: dawidd6/action-download-artifact@v10
8073
with:
8174
workflow: build.yml
@@ -86,7 +79,6 @@ jobs:
8679
name_is_regexp: true
8780
path: toolchain
8881
- name: Set up QEMU
89-
if: ${{matrix.file == 'Dockerfile.toolchain'}}
9082
uses: docker/setup-qemu-action@v3
9183
- name: Set up Docker Buildx
9284
uses: docker/setup-buildx-action@v3
@@ -98,42 +90,11 @@ jobs:
9890
password: ${{secrets.DOCKER_PASSWORD}}
9991
- name: Build Docker images
10092
uses: docker/build-push-action@v5
101-
id: build
10293
with:
10394
context: .
104-
platforms: ${{matrix.platforms}}
95+
platforms: linux/amd64,linux/arm64
10596
push: ${{inputs.push}}
106-
file: ./${{matrix.file}}
107-
outputs: |
108-
type=image,name=mstorsjo/llvm-mingw,push-by-digest=true,name-canonical=true
109-
- name: Write outputs for later steps
110-
uses: cloudposse/github-action-matrix-outputs-write@main
111-
id: out
112-
with:
113-
matrix-step-name: ${{github.job}}
114-
matrix-key: ${{matrix.key}}
115-
outputs: |-
116-
digest: ${{steps.build.outputs.digest}}
117-
118-
docker-create:
119-
needs: [docker-build, prepare]
120-
runs-on: ubuntu-latest
121-
if: ${{inputs.push}}
122-
steps:
123-
- uses: cloudposse/github-action-matrix-outputs-read@main
124-
id: read
125-
with:
126-
matrix-step-name: docker-build
127-
- name: Set up Docker Buildx
128-
uses: docker/setup-buildx-action@v3
129-
- name: Log in to Docker Hub
130-
uses: docker/login-action@v3
131-
with:
132-
username: ${{vars.DOCKER_USERNAME}}
133-
password: ${{secrets.DOCKER_PASSWORD}}
134-
- name: Create final image
135-
run: |
136-
set -x
137-
for tag in latest ${{needs.prepare.outputs.TAG}}; do
138-
docker buildx imagetools create -t mstorsjo/llvm-mingw:$tag mstorsjo/llvm-mingw@${{fromJson(steps.read.outputs.result).digest.amd64}} mstorsjo/llvm-mingw@${{fromJson(steps.read.outputs.result).digest.arm64}}
139-
done
97+
file: ./Dockerfile.toolchain
98+
tags: |
99+
mstorsjo/llvm-mingw:latest
100+
mstorsjo/llvm-mingw:${{needs.prepare.outputs.TAG}}

0 commit comments

Comments
 (0)