Skip to content

docker: Bump the base images to Ubuntu 24.04 #104

docker: Bump the base images to Ubuntu 24.04

docker: Bump the base images to Ubuntu 24.04 #104

Workflow file for this run

name: Build docker images
on:
push:
workflow_dispatch:
inputs:
commit:
description: 'Commit to extract from'
type: string
branch:
description: 'Branch to extract from'
type: string
default: 'master'
login:
description: 'Log in to Docker Hub'
type: boolean
default: true
push:
description: 'Push the built images'
type: boolean
default: false
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
TAG: ${{steps.get-parameters.outputs.TAG}}
steps:
- name: Download build parameters
if: false
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
workflow_conclusion: success
commit: ${{inputs.commit}}
branch: ${{inputs.branch}}
event: push
name: parameters
- name: Get build parameters
id: get-parameters
run: |
echo TAG=test >> $GITHUB_OUTPUT
#cat parameters.txt >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
docker-build-dev:
needs: [prepare]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { file: Dockerfile, maintag: latest, prefix: }
- { file: Dockerfile.dev, maintag: dev, prefix: dev- }
steps:
- uses: actions/checkout@v4
- name: Log in to Docker Hub
if: false
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Build Docker images
uses: docker/build-push-action@v5
with:
context: .
push: false
file: ./${{matrix.file}}
tags: |
mstorsjo/llvm-mingw:${{matrix.maintag}}
mstorsjo/llvm-mingw:${{matrix.prefix}}${{needs.prepare.outputs.TAG}}
- name: Inspect Docker images
run: |
docker images
- name: Extract toolchain
if: ${{ (matrix.file == 'Dockerfile') }}
env:
TAG: ${{needs.prepare.outputs.TAG}}
run: |
DISTRO=ubuntu-24.04-$(uname -m)
docker run --rm mstorsjo/llvm-mingw:latest sh -c "cd /opt && mv llvm-mingw llvm-mingw-$TAG-ucrt-$DISTRO && tar -Jcvf - --format=ustar --numeric-owner --owner=0 --group=0 llvm-mingw-$TAG-ucrt-$DISTRO" > llvm-mingw-$TAG-ucrt-$DISTRO.tar.xz
- name: Upload image as artifact
if: ${{ (matrix.file == 'Dockerfile') }}
uses: ishworkh/[email protected]
with:
retention_days: 3
image: mstorsjo/llvm-mingw:latest
- uses: actions/upload-artifact@v4
if: ${{ (matrix.file == 'Dockerfile') }}
with:
name: linux-ucrt-x86_64-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7
docker-build-cross:
needs: [docker-build-dev, prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download image
uses: ishworkh/[email protected]
with:
image: mstorsjo/llvm-mingw:latest
- name: Build Docker images
uses: docker/build-push-action@v5
with:
context: .
push: false
file: ./Dockerfile.cross
load: true
build-args: |
BASE=mstorsjo/llvm-mingw:latest
CROSS_ARCH=x86_64
TAG=${{needs.prepare.outputs.TAG}}-ucrt-
WITH_PYTHON=1
tags: |
mstorsjo/llvm-mingw-cross:latest
- name: Inspect Docker images, extract output
env:
TAG: ${{needs.prepare.outputs.TAG}}
run: |
docker images
./extract-docker.sh mstorsjo/llvm-mingw-cross:latest /llvm-mingw-$TAG-ucrt-x86_64.zip
- uses: actions/upload-artifact@v4
with:
name: windows-ucrt-x86_64-toolchain
path: |
llvm-mingw-*.zip
retention-days: 7
docker-build:
needs: [prepare]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { file: Dockerfile.toolchain, platforms: linux/arm64, key: arm64 }
steps:
- uses: actions/checkout@v4
- name: Download toolchain
if: ${{matrix.file == 'Dockerfile.toolchain'}}
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
workflow_conclusion: success
commit:
branch: master
event: schedule
name: linux-ucrt-.*
name_is_regexp: true
path: toolchain
- name: Set up QEMU
if: ${{matrix.file == 'Dockerfile.toolchain'}}
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: false
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Build Docker images
uses: docker/build-push-action@v5
id: build
with:
context: .
platforms: ${{matrix.platforms}}
push: false
file: ./${{matrix.file}}
outputs: |
type=image,name=mstorsjo/llvm-mingw,push-by-digest=true,name-canonical=true
- name: Write outputs for later steps
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: false
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: ${{secrets.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