Skip to content

Commit 0de8a91

Browse files
authored
fix: split CPU docker build into native amd64/arm64 jobs to prevent 6h timeout (#1418)
* 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. * fix: sanitize Docker tag — replace slashes in branch names with dashes * fix: only update latest-cpu/gpu tags on release, not on nightly schedule * fix: set DEBIAN_FRONTEND=noninteractive to prevent tzdata prompt hanging Docker build * revert: use build-push-action@v5 for GPU jobs (v6 causes SIGTERM in dry-run) * fix: upgrade NVHPC 23.11→24.5 and fix ARM compiler path for GPU Docker builds * fix: pass --gpu acc to build and test in GPU Dockerfile (nvfortran uses OpenACC)
1 parent 2ecf477 commit 0de8a91

2 files changed

Lines changed: 37 additions & 22 deletions

File tree

.github/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ ARG FC_COMPILER
88
ARG COMPILER_PATH
99
ARG COMPILER_LD_LIBRARY_PATH
1010

11+
ENV DEBIAN_FRONTEND=noninteractive
12+
ENV TZ=UTC
13+
1114
RUN apt-get update -y && \
1215
apt-get install -y software-properties-common ca-certificates gnupg && \
1316
add-apt-repository ppa:deadsnakes/ppa && \
@@ -50,14 +53,14 @@ RUN python3.12 -m venv /opt/MFC/build/venv && \
5053
RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \
5154
cd /opt/MFC && \
5255
if [ "$TARGET" = "gpu" ]; then \
53-
./mfc.sh build --gpu -j $(nproc); \
56+
./mfc.sh build --gpu acc -j $(nproc); \
5457
else \
5558
./mfc.sh build -j $(nproc); \
5659
fi
5760

5861
RUN cd /opt/MFC && \
5962
if [ "$TARGET" = "gpu" ]; then \
60-
./mfc.sh test -a --dry-run --gpu -j $(nproc); \
63+
./mfc.sh test -a --dry-run --gpu acc -j $(nproc); \
6164
else \
6265
./mfc.sh test -a --dry-run -j $(nproc); \
6366
fi

.github/workflows/docker.yml

Lines changed: 32 additions & 20 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:24.5-devel-cuda_multi-ubuntu22.04', compiler_arch: 'Linux_x86_64' }
26+
- { name: 'gpu', runner: 'ubuntu-22.04-arm', base_image: 'nvcr.io/nvidia/nvhpc:24.5-devel-cuda_multi-ubuntu22.04', compiler_arch: 'Linux_aarch64' }
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=$(echo "$BRANCH" | tr '/' '-')
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,7 +92,7 @@ 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)
@@ -105,8 +108,8 @@ jobs:
105108
CC_COMPILER=${{ 'nvc' }}
106109
CXX_COMPILER=${{ 'nvc++' }}
107110
FC_COMPILER=${{ 'nvfortran' }}
108-
COMPILER_PATH=${{ '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/bin' }}
109-
COMPILER_LD_LIBRARY_PATH=${{ '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/lib' }}
111+
COMPILER_PATH=/opt/nvidia/hpc_sdk/${{ matrix.config.compiler_arch }}/compilers/bin
112+
COMPILER_LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/${{ matrix.config.compiler_arch }}/compilers/lib
110113
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner}}
111114
push: true
112115

@@ -120,13 +123,22 @@ 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:$TAG-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm
136+
137+
- name: Update latest tags
138+
if: github.event_name == 'release'
139+
env:
140+
TAG: ${{ needs.Container.outputs.tag }}
141+
REGISTRY: ${{ secrets.DOCKERHUB_USERNAME }}/mfc
142+
run: |
143+
docker buildx imagetools create -t $REGISTRY:latest-cpu $REGISTRY:$TAG-cpu-ubuntu-22.04 $REGISTRY:$TAG-cpu-ubuntu-22.04-arm
144+
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)