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 12, 2024
1 parent bbfdfeb commit cd6b5f5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
29 changes: 20 additions & 9 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-py_3.all
- ubuntu_22.04-clang_11-vtk_9.2.2-py_3.all
- ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.all
- ubuntu_24.04-gcc_13-vtk_9.3.1-py_3.all
default: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.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,7 +46,11 @@ jobs:
exit 1
fi
echo "VTK_VERSION=${CONFIG[5]}" >> $GITHUB_ENV
echo "PYTHON_VERSION=${CONFIG[7]}" >> $GITHUB_ENV
if [[ "${CONFIG[7]}" == "3.all" ]]; then
echo "PYTHON_VERSIONS=3.8,3.9,3.10,3.11,3.12" >> $GITHUB_ENV
else
echo "PYTHON_VERSIONS=${CONFIG[7]}" >> $GITHUB_ENV
fi
echo "DOCKER_TAG=${{ inputs.image }}" >> $GITHUB_ENV
- name: Build configuration
Expand All @@ -49,7 +60,7 @@ jobs:
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-py_3.all ]
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -33,7 +33,11 @@ jobs:
exit 1
fi
echo "VTK_VERSION=${CONFIG[5]}" >> $GITHUB_ENV
echo "PYTHON_VERSION=${CONFIG[7]}" >> $GITHUB_ENV
if [[ "${CONFIG[7]}" == "3.all" ]]; then
echo "PYTHON_VERSIONS=3.8,3.9,3.10,3.11,3.12" >> $GITHUB_ENV
else
echo "PYTHON_VERSIONS=${CONFIG[7]}" >> $GITHUB_ENV
fi
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_VERSIONS"
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 cd6b5f5

Please sign in to comment.