Skip to content

Commit

Permalink
#97: reorganize docker push image script for multiple python versions…
Browse files Browse the repository at this point in the history
… support
  • Loading branch information
tlamonthezie committed Sep 6, 2024
1 parent bd83c22 commit 57418bb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/pushbasedockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@ on:
inputs:
image:
type: choice
description: The configuration to build as a combination of os, compiler, vtk and python versions
description: The configuration to build as a combination of os, compiler, vtk
options:
- ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.8
- ubuntu_22.04-clang_11-vtk_9.2.2-py_3.8
- ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
- ubuntu_24.04-gcc_13-vtk_9.3.1-py_3.8
default: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
- ubuntu_22.04-gcc_11-vtk_9.2.2-py3.all
- ubuntu_22.04-clang_11-vtk_9.2.2-py3.all
- ubuntu_22.04-gcc_12-vtk_9.3.0-py3.all
- ubuntu_24.04-gcc_13-vtk_9.3.1-py3.all
default: ubuntu_22.04-gcc_12-vtk_9.3.0-py3.all

jobs:
push_to_registry:
name: Build & Push
runs-on: ubuntu-latest
env:
DOCKER_REPOSITORY: lifflander1/vt
DOCKER_TAG: ~
BASE_IMAGE: ~
CXX: ~
CC: ~
GCOV: ~
VTK_VERSION: ~
PYTHON_VERSIONS: ~
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -39,17 +46,21 @@ jobs:
exit 1
fi
echo "VTK_VERSION=${CONFIG[5]}" >> $GITHUB_ENV
echo "PYTHON_VERSION=${CONFIG[7]}" >> $GITHUB_ENV
if [ "${CONFIG[7]}" -eq "py3.all" ]]; then
"PYTHON_VERSIONS=3.8,3.9,3.10,3.11,3.12" >> $GITHUB_ENV
else
"PYTHON_VERSIONS=${CONFIG[7]}" >> $GITHUB_ENV
fi
echo "DOCKER_TAG=${{ inputs.image }}" >> $GITHUB_ENV
- name: Build configuration
run: |
echo "Base image: $BASE_IMAGE"
echo "C Compiler: $CC"
echo "CXX Compiler: $CXX"
echo "GCOV: $GCOV"
echo "VTK: $VTK_VERSION"
echo "Python: $PYTHON_VERSION"
echo "Python: $PYTHON_VERSIONS"
echo "Docker tag: $DOCKER_TAG"
- name: Log in to Docker Hub
Expand All @@ -68,7 +79,7 @@ jobs:
CXX=${{ env.CXX }}
GCOV=${{ env.GCOV }}
VTK_VERSION=${{ env.VTK_VERSION }}
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
PYTHON_VERSIONS=${{ env.PYTHON_VERSIONS }}
file: ci/docker/make-base-ubuntu.dockerfile
push: true
tags: "${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_TAG }}"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & push base Docker image (add ubuntu_24.04-gcc_12-vtk_9.3.1-py_3.8 image)
name: Build & push base Docker image (add ubuntu_24.04-gcc_12-vtk_9.3.1-py_3.8_3.12 image)

on:
push:
Expand All @@ -13,7 +13,7 @@ jobs:
DOCKER_REPOSITORY: lifflander1/vt
strategy:
matrix:
image: [ ubuntu_24.04-gcc_13-vtk_9.3.1-py_3.8 ]
image: [ ubuntu_24.04-gcc_12-vtk_9.3.1-py3.all ]
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -32,8 +32,12 @@ jobs:
else
exit 1
fi
if [ "${CONFIG[7]}" -eq "py3.all" ]]; then
"PYTHON_VERSIONS=3.8,3.9,3.10,3.11,3.12" >> $GITHUB_ENV
else
"PYTHON_VERSIONS=${CONFIG[7]}" >> $GITHUB_ENV
fi
echo "VTK_VERSION=${CONFIG[5]}" >> $GITHUB_ENV
echo "PYTHON_VERSION=${CONFIG[7]}" >> $GITHUB_ENV
echo "DOCKER_TAG=${{ matrix.image }}" >> $GITHUB_ENV
- name: Build configuration
Expand All @@ -43,7 +47,7 @@ jobs:
echo "CXX Compiler: $CXX"
echo "GCOV: $GCOV"
echo "VTK: $VTK_VERSION"
echo "Python: $PYTHON_VERSION"
echo "Python: $PYTHON"
echo "Docker tag: $DOCKER_TAG"
- name: Log in to Docker Hub
Expand All @@ -62,7 +66,7 @@ jobs:
CXX=${{ env.CXX }}
GCOV=${{ env.GCOV }}
VTK_VERSION=${{ env.VTK_VERSION }}
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
PYTHON_VERSIONS=${{ env.PYTHON_VERSIONS }}
file: ci/docker/make-base-ubuntu.dockerfile
push: true
tags: "${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_TAG }}"
9 changes: 5 additions & 4 deletions ci/docker/make-base-ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ RUN apt update -y -q && \
RUN bash /opt/scripts/setup_mesa.sh
RUN xvfb-run bash -c "glxinfo | grep 'OpenGL version'"

# Setup conda and python environments
RUN bash /opt/scripts/setup_conda.sh ${PYTHON_VERSIONS}

# Setup compiler using environment variables
# Setup environment variables (conda path, python environments, compiler path)
ENV CC=/usr/bin/$CC
ENV CXX=/usr/bin/$CXX
ENV GCOV=/usr/bin/$GCOV
ENV CONDA_PREFIX=/opt/conda

# Setup conda with python environments
RUN bash /opt/scripts/setup_conda.sh ${PYTHON_VERSIONS}

# Setup VTK
RUN VTK_VERSION=${VTK_VERSION} \
Expand Down

0 comments on commit 57418bb

Please sign in to comment.