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 8f42112719,
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.
This commit is contained in:
1 parent
ca34a15634
commit
04bc2bc1c5
1 file changed
+5
-44
@@ -64,18 +64,11 @@ jobs:
|
|||||||
docker-build:
|
docker-build:
|
||||||
needs: [prepare]
|
needs: [prepare]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- { file: Dockerfile, key: amd64 }
|
|
||||||
- { file: Dockerfile.toolchain, platforms: linux/arm64, key: arm64 }
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{inputs.ref}}
|
ref: ${{inputs.ref}}
|
||||||
- name: Download toolchain
|
- name: Download toolchain
|
||||||
if: ${{matrix.file == 'Dockerfile.toolchain'}}
|
|
||||||
uses: dawidd6/action-download-artifact@v10
|
uses: dawidd6/action-download-artifact@v10
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
@@ -86,7 +79,6 @@ jobs:
|
|||||||
name_is_regexp: true
|
name_is_regexp: true
|
||||||
path: toolchain
|
path: toolchain
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
if: ${{matrix.file == 'Dockerfile.toolchain'}}
|
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
@@ -98,42 +90,11 @@ jobs:
|
|||||||
password: ${{secrets.DOCKER_PASSWORD}}
|
password: ${{secrets.DOCKER_PASSWORD}}
|
||||||
- name: Build Docker images
|
- name: Build Docker images
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
id: build
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: ${{matrix.platforms}}
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{inputs.push}}
|
push: ${{inputs.push}}
|
||||||
file: ./${{matrix.file}}
|
file: ./Dockerfile.toolchain
|
||||||
outputs: |
|
tags: |
|
||||||
type=image,name=mstorsjo/llvm-mingw,push-by-digest=true,name-canonical=true
|
mstorsjo/llvm-mingw:latest
|
||||||
- name: Write outputs for later steps
|
mstorsjo/llvm-mingw:${{needs.prepare.outputs.TAG}}
|
||||||
uses: cloudposse/github-action-matrix-outputs-write@main
|
|
||||||
id: out
|
|
||||||
with:
|
|
||||||
matrix-step-name: ${{github.job}}
|
|
||||||
matrix-key: ${{matrix.key}}
|
|
||||||
outputs: |-
|
|
||||||
digest: ${{steps.build.outputs.digest}}
|
|
||||||
|
|
||||||
docker-create:
|
|
||||||
needs: [docker-build, prepare]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{inputs.push}}
|
|
||||||
steps:
|
|
||||||
- uses: cloudposse/github-action-matrix-outputs-read@main
|
|
||||||
id: read
|
|
||||||
with:
|
|
||||||
matrix-step-name: docker-build
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{vars.DOCKER_USERNAME}}
|
|
||||||
password: ${{secrets.DOCKER_PASSWORD}}
|
|
||||||
- name: Create final image
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
for tag in latest ${{needs.prepare.outputs.TAG}}; do
|
|
||||||
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}}
|
|
||||||
done
|
|
||||||
Reference in new issue
Block a user