Skip to content

Commit b9dc1b3

Browse files
author
Malmahrouqi3
committed
few fixes: docker builder + bc package
1 parent b03c950 commit b9dc1b3

File tree

2 files changed

+51
-17
lines changed

2 files changed

+51
-17
lines changed

.github/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ ARG COMPILER_LD_LIBRARY_PATH
1111
RUN apt-get update -y && \
1212
if [ "$TARGET" != "gpu" ]; then \
1313
apt-get install -y \
14-
build-essential git make cmake gcc g++ gfortran \
14+
build-essential git make cmake gcc g++ gfortran bc\
1515
python3 python3-venv python3-pip \
1616
openmpi-bin libopenmpi-dev libfftw3-dev \
1717
mpich libmpich-dev; \
1818
else \
1919
apt-get install -y \
20-
build-essential git make cmake \
20+
build-essential git make cmake bc\
2121
python3 python3-venv python3-pip \
2222
libfftw3-dev \
2323
openmpi-bin libopenmpi-dev; \

.github/workflows/docker.yml

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,24 @@ jobs:
1818
strategy:
1919
matrix:
2020
config:
21-
- { name: 'cpu', runner: 'ubuntu-22.04', base_image: 'ubuntu:22.04' }
22-
- { name: 'cpu', runner: 'ubuntu-22.04-arm', base_image: 'ubuntu:22.04' }
23-
- { name: 'gpu', runner: 'ubuntu-22.04', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda12.3-ubuntu22.04' }
24-
- { name: 'gpu', runner: 'ubuntu-22.04-arm', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda12.3-ubuntu22.04' }
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' }
2524
runs-on: ${{ matrix.config.runner }}
2625
outputs:
2726
tag: ${{ steps.clone.outputs.tag }}
2827
steps:
28+
- name: Free Disk Space
29+
uses: jlumbroso/free-disk-space@main
30+
with:
31+
tool-cache: false
32+
android: true
33+
dotnet: true
34+
haskell: true
35+
large-packages: true
36+
docker-images: true
37+
swap-storage: true
38+
2939
- name: Login
3040
uses: docker/login-action@v3
3141
with:
@@ -48,27 +58,55 @@ jobs:
4858
4959
- name: Stage
5060
run: |
61+
sudo fallocate -l 8G /swapfile
62+
sudo chmod 600 /swapfile
63+
sudo mkswap /swapfile
64+
sudo swapon /swapfile
65+
sudo mkdir -p /home/runner/tmp
66+
export TMPDIR=/home/runner/tmp
67+
free -h
5168
sudo mkdir -p /mnt/share
5269
sudo chmod 777 /mnt/share
5370
cp -r mfc/* /mnt/share/
5471
cp -r mfc/.git /mnt/share/.git
5572
cp mfc/.github/Dockerfile /mnt/share/
5673
cp mfc/.github/.dockerignore /mnt/share/
74+
docker buildx create --name mfcbuilder --driver docker-container --use
5775
58-
- name: Build and Deploy
76+
- name: Build and push image (cpu)
77+
if: ${{ matrix.config.name == 'cpu' }}
5978
uses: docker/build-push-action@v6
79+
with:
80+
builder: mfcbuilder
81+
context: /mnt/share
82+
file: /mnt/share/Dockerfile
83+
platforms: linux/amd64,linux/arm64
84+
build-args: |
85+
BASE_IMAGE=${{ matrix.config.base_image }}
86+
TARGET=${{ matrix.config.name }}
87+
CC_COMPILER=${{ 'gcc' }}
88+
CXX_COMPILER=${{ 'g++' }}
89+
FC_COMPILER=${{ 'gfortran' }}
90+
COMPILER_PATH=${{ '/usr/bin' }}
91+
COMPILER_LD_LIBRARY_PATH=${{ '/usr/lib' }}
92+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}
93+
push: true
94+
95+
- name: Build and push image (gpu)
96+
if: ${{ matrix.config.name == 'gpu' }}
97+
uses: docker/build-push-action@v5
6098
with:
6199
builder: default
62100
context: /mnt/share
63101
file: /mnt/share/Dockerfile
64102
build-args: |
65103
BASE_IMAGE=${{ matrix.config.base_image }}
66104
TARGET=${{ matrix.config.name }}
67-
CC_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvc' || 'gcc' }}
68-
CXX_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvc++' || 'g++' }}
69-
FC_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvfortran' || 'gfortran' }}
70-
COMPILER_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/bin' || '/usr/bin' }}
71-
COMPILER_LD_LIBRARY_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/lib' || '/usr/lib' }}
105+
CC_COMPILER=${{ 'nvc' }}
106+
CXX_COMPILER=${{ 'nvc++' }}
107+
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' }}
72110
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner}}
73111
push: true
74112

@@ -87,12 +125,8 @@ jobs:
87125
TAG: ${{ needs.Container.outputs.tag }}
88126
REGISTRY: ${{ secrets.DOCKERHUB_USERNAME }}/mfc
89127
run: |
90-
docker manifest create $REGISTRY:$TAG-cpu $REGISTRY:$TAG-cpu-ubuntu-22.04 $REGISTRY:$TAG-cpu-ubuntu-22.04-arm
128+
docker buildx imagetools create -t $REGISTRY:latest-cpu $REGISTRY:$TAG-cpu
91129
docker manifest create $REGISTRY:$TAG-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm
92-
docker manifest create $REGISTRY:latest-cpu $REGISTRY:$TAG-cpu-ubuntu-22.04 $REGISTRY:$TAG-cpu-ubuntu-22.04-arm
93130
docker manifest create $REGISTRY:latest-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm
94-
95-
docker manifest push $REGISTRY:$TAG-cpu
96131
docker manifest push $REGISTRY:$TAG-gpu
97-
docker manifest push $REGISTRY:latest-cpu
98132
docker manifest push $REGISTRY:latest-gpu

0 commit comments

Comments
 (0)