Skip to content

Commit 0aca803

Browse files
author
Malmahrouqi3
committed
devcontainer & workflow updates
1 parent f348b78 commit 0aca803

File tree

4 files changed

+68
-20
lines changed

4 files changed

+68
-20
lines changed

.devcontainer/devcontainer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "MFC Container",
3+
"image": "sbryngelson/mfc:latest-cpu",
4+
"workspaceFolder": "/opt/MFC",
5+
"settings": {
6+
"terminal.integrated.shell.linux": "/bin/bash",
7+
"editor.formatOnSave": true
8+
},
9+
}

.github/.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ yarn.lock
44

55
.venv/
66
.vscode/
7-
src/*/include/case.fpp
87
src/*/autogen/
98

109
*.swo

.github/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ RUN apt-get update -y && \
1414
build-essential git make cmake gcc g++ gfortran \
1515
python3 python3-venv python3-pip \
1616
openmpi-bin libopenmpi-dev libfftw3-dev \
17-
libatlas-base-dev mpich libmpich-dev; \
17+
mpich libmpich-dev; \
1818
else \
1919
apt-get install -y \
2020
build-essential git make cmake \
2121
python3 python3-venv python3-pip \
22-
libfftw3-dev libatlas-base-dev \
22+
libfftw3-dev \
2323
openmpi-bin libopenmpi-dev; \
2424
fi && \
2525
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -52,4 +52,4 @@ RUN cd /opt/MFC && \
5252
fi
5353

5454
WORKDIR /opt/MFC
55-
ENTRYPOINT ["bash"]
55+
ENTRYPOINT ["tail", "-f", "/dev/null"]

.github/workflows/docker.yml

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,61 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'tag to containerize'
10+
required: true
11+
12+
concurrency:
13+
group: Containerization-${{ github.event.inputs.tag || github.ref_name }}
14+
cancel-in-progress: false
715

816
jobs:
917
Container:
10-
runs-on: ubuntu-latest
1118
strategy:
1219
matrix:
1320
config:
14-
- { name: 'cpu', base_image: 'ubuntu:22.04'}
15-
- { name: 'gpu', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda12.3-ubuntu22.04'}
16-
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' }
25+
runs-on: ${{ matrix.config.runner }}
1726
steps:
18-
- name: Clone
19-
uses: actions/checkout@v4
20-
with:
21-
path: mfc
22-
2327
- name: Login
2428
uses: docker/login-action@v3
2529
with:
2630
username: ${{ secrets.DOCKERHUB_USERNAME }}
2731
password: ${{ secrets.DOCKERHUB_PASSWORD }}
2832

29-
- name: Setup
33+
- name: Setup Buildx
3034
uses: docker/setup-buildx-action@v3
3135

32-
- name: Stage
36+
- name: Setup QEMU
37+
uses: docker/setup-qemu-action@v3
38+
39+
- name: Clone
3340
run: |
3441
if [ -n "${{ github.event.inputs.tag }}" ]; then
3542
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
3643
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
3744
echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
3845
fi
3946
47+
git clone --branch ${{ env.TAG }} --depth 1 https://github.com/MFlowCode/MFC.git mfc
48+
49+
- name: Stage
50+
run: |
4051
sudo mkdir -p /mnt/share
4152
sudo chmod 777 /mnt/share
4253
cp -r mfc/* /mnt/share/
4354
cp -r mfc/.git /mnt/share/.git
4455
cp mfc/.github/Dockerfile /mnt/share/
4556
cp mfc/.github/.dockerignore /mnt/share/
46-
docker buildx create --name mfcbuilder --driver docker-container --use
4757
4858
- name: Build and Deploy
4959
uses: docker/build-push-action@v5
5060
with:
51-
builder: mfcbuilder
61+
builder: default
5262
context: /mnt/share
5363
file: /mnt/share/Dockerfile
5464
build-args: |
@@ -59,7 +69,37 @@ jobs:
5969
FC_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvfortran' || 'gfortran' }}
6070
COMPILER_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/bin' || '/usr/bin' }}
6171
COMPILER_LD_LIBRARY_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/lib' || '/usr/lib' }}
62-
tags: sbryngelson/mfc:${{ env.TAG }}-${{ matrix.config.name }}
72+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner}}
6373
push: true
64-
cache-from: type=gha
65-
cache-to: type=gha,mode=max
74+
75+
manifests:
76+
runs-on: ubuntu-latest
77+
needs: Container
78+
steps:
79+
- name: Login
80+
uses: docker/login-action@v3
81+
with:
82+
username: ${{ secrets.DOCKERHUB_USERNAME }}
83+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
84+
85+
- name: Create and Push Manifest Lists
86+
run: |
87+
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-cpu \
88+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-cpu-ubuntu-22.04 \
89+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-cpu-ubuntu-22.04-arm
90+
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-cpu
91+
92+
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/mfc:latest-cpu \
93+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-cpu-ubuntu-22.04 \
94+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-cpu-ubuntu-22.04-arm
95+
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/mfc:latest-cpu
96+
97+
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-gpu \
98+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-gpu-ubuntu-22.04 \
99+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-gpu-ubuntu-22.04-arm
100+
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-gpu
101+
102+
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/mfc:latest-gpu \
103+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-gpu-ubuntu-22.04 \
104+
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-gpu-ubuntu-22.04-arm
105+
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/mfc:latest-gpu

0 commit comments

Comments
 (0)