Skip to content

Commit

Permalink
#97: differenciate base docker files for ubuntu 22 and ubuntu 24 ci t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
tlamonthezie committed Sep 2, 2024
1 parent 300f000 commit f1d9369
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- 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
env:
OUTPUT_DIR: '/tmp/artifacts'
VT_TV_TESTS_ENABLED: 'ON' # Build & Test in all configurations
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pushbasedockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 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_12-vtk_9.3.1-py_3.8
default: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8

jobs:
Expand All @@ -27,6 +28,7 @@ jobs:
run: |
IFS='_-' read -r -a CONFIG <<< "${{ inputs.image }}"
echo "BASE_IMAGE=${CONFIG[0]}:${CONFIG[1]}" >> $GITHUB_ENV
echo "BASE_DOCKERFILE=make-base-${CONFIG[0]}-${CONFIG[1]}.dockerfile" >> $GITHUB_ENV
echo "CC=${CONFIG[2]}-${CONFIG[3]}" >> $GITHUB_ENV
if [[ "${CONFIG[2]}" == "gcc" ]]; then
echo "CXX=g++-${CONFIG[3]}" >> $GITHUB_ENV
Expand Down Expand Up @@ -68,6 +70,6 @@ jobs:
GCOV=${{ env.GCOV }}
VTK_VERSION=${{ env.VTK_VERSION }}
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
file: ci/docker/make-base.dockerfile
file: ci/docker/${{ env.BASE_DOCKERFILE }}
push: true
tags: "${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_TAG }}"
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ RUN git clone --recursive --branch v${VTK_VERSION} https://gitlab.kitware.com/vt
# Build VTK
RUN mkdir -p ${VTK_DIR}
WORKDIR ${VTK_DIR}
RUN cmake \
RUN if [ "${BASE_IMAGE}" ] cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTING:BOOL=OFF \
-DVTK_OPENGL_HAS_OSMESA:BOOL=OFF \
-DVTK_OPENGL_HAS_OSMESA:BOOL=ON \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=ON \
-DVTK_USE_X:BOOL=ON \
-DVTK_USE_X:BOOL=OFF \
-DVTK_USE_WIN32_OPENGL:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=OFF \
-DVTK_USE_SDL2:BOOL=OFF \
Expand Down
103 changes: 103 additions & 0 deletions ci/docker/make-base-ubuntu-24.04.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Docker instructions to build an image with some arguments to specify compilers, python and VTK versions.
# @see .github/workflows/pushbasedockerimage.yml

ARG BASE_IMAGE=ubuntu:24.04

# Base image & requirements
FROM ${BASE_IMAGE} AS base

# Arguments
ARG VTK_VERSION=v9.2.2
ARG PYTHON_VERSION=3.8
ARG CC=gcc-11
ARG CXX=g++-11
ARG GCOV=gcov-11

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y -q && \
apt-get install -y -q --no-install-recommends \
${CC} \
${CXX} \
git \
xz-utils \
bzip2 \
zip \
gpg \
wget \
gpgconf \
software-properties-common \
libsigsegv2 \
libsigsegv-dev \
pkg-config \
zlib1g \
zlib1g-dev \
m4 \
gfortran-11 \
make \
cmake-data \
cmake \
pkg-config \
libncurses5-dev \
m4 \
libgl1-mesa-dev \
libglu1-mesa-dev \
mesa-common-dev \
libosmesa6-dev \
perl \
curl \
xvfb \
lcov \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Share environment variables for use in images based on this.
ENV CC=/usr/bin/$CC
ENV CXX=/usr/bin/$CXX
ENV GCOV=/usr/bin/$GCOV
ENV VTK_DIR=/opt/build/vtk

# Setup python 3.8 with conda

# Download and install Miniconda
RUN curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda && \
rm Miniconda3-latest-Linux-x86_64.sh

# Update PATH so that conda and the installed packages are usable
ENV PATH="/opt/conda/bin:${PATH}"

# Create a new environment and install necessary packages
RUN conda create -y -n deves python=${PYTHON_VERSION} && \
echo "source activate deves" > ~/.bashrc && \
/bin/bash -c ". /opt/conda/etc/profile.d/conda.sh && conda activate deves && pip install nanobind"

# Set the environment to deves on container run
ENV CONDA_DEFAULT_ENV=deves
ENV CONDA_PREFIX=/opt/conda/envs/$CONDA_DEFAULT_ENV
ENV PATH=$PATH:$CONDA_PREFIX/bin
ENV CONDA_AUTO_UPDATE_CONDA=false

# Clone VTK source
RUN mkdir -p /opt/src/vtk
RUN git clone --recursive --branch v${VTK_VERSION} https://gitlab.kitware.com/vtk/vtk.git /opt/src/vtk

# Build VTK
# Note: use X not OSMESA because of glew build error on ubuntu 24.04
RUN mkdir -p ${VTK_DIR}
WORKDIR ${VTK_DIR}
RUN if [ "${BASE_IMAGE}" ] cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTING:BOOL=OFF \
-DVTK_OPENGL_HAS_OSMESA:BOOL=OFF \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=ON \
-DVTK_USE_X:BOOL=ON \
-DVTK_USE_WIN32_OPENGL:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=OFF \
-DVTK_USE_SDL2:BOOL=OFF \
-DVTK_Group_Rendering:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-S /opt/src/vtk -B ${VTK_DIR}
RUN cmake --build ${VTK_DIR} -j$(nproc)

RUN echo "Base creation success"

0 comments on commit f1d9369

Please sign in to comment.