Skip to content

Commit 3c6e5dd

Browse files
committed
fix: split CPU docker build into native amd64/arm64 jobs to prevent 6h timeout
The CPU container job was using QEMU to cross-compile linux/arm64 on a single x86 runner, consistently hitting the 6-hour GitHub Actions limit. All recent releases (v5.1.3 through v5.3.1) failed to publish latest-cpu. Fix: split into two native jobs (ubuntu-22.04 and ubuntu-22.04-arm), mirroring the existing GPU build pattern. Remove QEMU. Merge into a multi-arch manifest in the manifests job using buildx imagetools. Also: add weekly schedule trigger (Sunday midnight UTC) so the devcontainer image stays fresh between releases, and bump build-push-action to v6.
1 parent 462cac7 commit 3c6e5dd

1 file changed

Lines changed: 24 additions & 19 deletions

File tree

.github/workflows/docker.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ name: Containerization
33
on:
44
release:
55
types: [published]
6+
schedule:
7+
- cron: '0 0 * * 0'
68
workflow_dispatch:
79
inputs:
810
tag:
911
description: 'tag to containerize'
10-
required: true
12+
required: false
1113

1214
concurrency:
1315
group: Containerization
@@ -18,9 +20,10 @@ jobs:
1820
strategy:
1921
matrix:
2022
config:
21-
- { name: 'cpu', runner: 'ubuntu-22.04', base_image: 'ubuntu:22.04' }
22-
- { name: 'gpu', runner: 'ubuntu-22.04', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda_multi-ubuntu22.04' }
23-
- { name: 'gpu', runner: 'ubuntu-22.04-arm', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda_multi-ubuntu22.04' }
23+
- { name: 'cpu', runner: 'ubuntu-22.04', base_image: 'ubuntu:22.04' }
24+
- { name: 'cpu', runner: 'ubuntu-22.04-arm', base_image: 'ubuntu:22.04' }
25+
- { name: 'gpu', runner: 'ubuntu-22.04', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda_multi-ubuntu22.04' }
26+
- { name: 'gpu', runner: 'ubuntu-22.04-arm', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda_multi-ubuntu22.04' }
2427
runs-on: ${{ matrix.config.runner }}
2528
outputs:
2629
tag: ${{ steps.clone.outputs.tag }}
@@ -45,16 +48,19 @@ jobs:
4548
- name: Setup Buildx
4649
uses: docker/setup-buildx-action@v3
4750

48-
- name: Setup QEMU
49-
uses: docker/setup-qemu-action@v3
50-
5151
- name: Clone
5252
id: clone
5353
run: |
54-
TAG="${{ github.event.inputs.tag || github.ref_name }}"
54+
if [ "${{ github.event_name }}" = "schedule" ]; then
55+
BRANCH="master"
56+
TAG="nightly"
57+
else
58+
BRANCH="${{ github.event.inputs.tag || github.ref_name }}"
59+
TAG="$BRANCH"
60+
fi
5561
echo "tag=$TAG" >> $GITHUB_OUTPUT
5662
echo "TAG=$TAG" >> $GITHUB_ENV
57-
git clone --branch "$TAG" --depth 1 ${{ github.server_url }}/${{ github.repository }}.git mfc
63+
git clone --branch "$BRANCH" --depth 1 ${{ github.server_url }}/${{ github.repository }}.git mfc
5864
5965
- name: Stage
6066
run: |
@@ -71,16 +77,13 @@ jobs:
7177
cp -r mfc/.git /mnt/share/.git
7278
cp mfc/.github/Dockerfile /mnt/share/
7379
cp mfc/.github/.dockerignore /mnt/share/
74-
docker buildx create --name mfcbuilder --driver docker-container --use
7580
7681
- name: Build and push image (cpu)
7782
if: ${{ matrix.config.name == 'cpu' }}
7883
uses: docker/build-push-action@v6
7984
with:
80-
builder: mfcbuilder
8185
context: /mnt/share
8286
file: /mnt/share/Dockerfile
83-
platforms: linux/amd64,linux/arm64
8487
build-args: |
8588
BASE_IMAGE=${{ matrix.config.base_image }}
8689
TARGET=${{ matrix.config.name }}
@@ -89,12 +92,12 @@ jobs:
8992
FC_COMPILER=${{ 'gfortran' }}
9093
COMPILER_PATH=${{ '/usr/bin' }}
9194
COMPILER_LD_LIBRARY_PATH=${{ '/usr/lib' }}
92-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}
95+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner }}
9396
push: true
9497

9598
- name: Build and push image (gpu)
9699
if: ${{ matrix.config.name == 'gpu' }}
97-
uses: docker/build-push-action@v5
100+
uses: docker/build-push-action@v6
98101
with:
99102
builder: default
100103
context: /mnt/share
@@ -120,13 +123,15 @@ jobs:
120123
username: ${{ secrets.DOCKERHUB_USERNAME }}
121124
password: ${{ secrets.DOCKERHUB_PASSWORD }}
122125

126+
- name: Setup Buildx
127+
uses: docker/setup-buildx-action@v3
128+
123129
- name: Create and Push Manifest Lists
124130
env:
125131
TAG: ${{ needs.Container.outputs.tag }}
126132
REGISTRY: ${{ secrets.DOCKERHUB_USERNAME }}/mfc
127133
run: |
128-
docker buildx imagetools create -t $REGISTRY:latest-cpu $REGISTRY:$TAG-cpu
129-
docker manifest create $REGISTRY:$TAG-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm
130-
docker manifest create $REGISTRY:latest-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm
131-
docker manifest push $REGISTRY:$TAG-gpu
132-
docker manifest push $REGISTRY:latest-gpu
134+
docker buildx imagetools create -t $REGISTRY:$TAG-cpu $REGISTRY:$TAG-cpu-ubuntu-22.04 $REGISTRY:$TAG-cpu-ubuntu-22.04-arm
135+
docker buildx imagetools create -t $REGISTRY:latest-cpu $REGISTRY:$TAG-cpu-ubuntu-22.04 $REGISTRY:$TAG-cpu-ubuntu-22.04-arm
136+
docker buildx imagetools create -t $REGISTRY:$TAG-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm
137+
docker buildx imagetools create -t $REGISTRY:latest-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm

0 commit comments

Comments
 (0)