Skip to content

Commit

Permalink
#97: fix of ubuntu 24 docker image mesa drivers version
Browse files Browse the repository at this point in the history
  • Loading branch information
tlamonthezie committed Sep 6, 2024
1 parent e9bddd8 commit 02671b1
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build & push base Docker image (add ubuntu_24.04-gcc_12-vtk_9.3.1-py_3.8 image)

on:
push:
branches:
- 97-add-more-environments-to-test-in-ci

jobs:
push_to_registry:
name: Build & Push
runs-on: ubuntu-latest
env:
DOCKER_REPOSITORY: lifflander1/vt
strategy:
matrix:
image: [ ubuntu_24.04-gcc_13-vtk_9.3.1-py_3.8 ]
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Extract build configuration
run: |
IFS='_-' read -r -a CONFIG <<< "${{ matrix.image }}"
echo "BASE_IMAGE=${CONFIG[0]}:${CONFIG[1]}" >> $GITHUB_ENV
echo "CC=${CONFIG[2]}-${CONFIG[3]}" >> $GITHUB_ENV
if [[ "${CONFIG[2]}" == "gcc" ]]; then
echo "CXX=g++-${CONFIG[3]}" >> $GITHUB_ENV
echo "GCOV=gcov-${CONFIG[3]}" >> $GITHUB_ENV
elif [[ "${CONFIG[2]}" == "clang" ]]; then
echo "CXX=clang++-${CONFIG[3]}" >> $GITHUB_ENV
echo "GCOV=gcov" >> $GITHUB_ENV
else
exit 1
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
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 "Docker tag: $DOCKER_TAG"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: .
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
CC=${{ env.CC }}
CXX=${{ env.CXX }}
GCOV=${{ env.GCOV }}
VTK_VERSION=${{ env.VTK_VERSION }}
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
file: ci/docker/make-base-ubuntu.dockerfile
push: true
tags: "${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_TAG }}"
10 changes: 10 additions & 0 deletions ci/docker/make-base-ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ RUN apt-get update -y -q && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Fix Ubuntu 24.04 Mesa driver issue by downloading most recent version of Mesa
RUN if [ $(uname -a) != *"Darwin"* ]; then \
. /etc/lsb-release; \
if [ "$DISTRIB_RELEASE" == "24.04" ]; then \
echo "Installing recent MESA drivers"; \
bash ci/upgrade_mesa_dev.sh; \
fi \
fi

# Share environment variables for use in images based on this.
ENV CC=/usr/bin/$CC
ENV CXX=/usr/bin/$CXX
Expand Down Expand Up @@ -83,6 +92,7 @@ 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

RUN mkdir -p /opt/scripts
COPY ci/vtk_build.sh /opt/scripts/vtk_build.sh
RUN VTK_DIR=${VTK_DIR} bash /opt/scripts/vtk_build.sh
Expand Down
10 changes: 10 additions & 0 deletions ci/upgrade_mesa_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# This script install latest version of Mesa driver on the system

add-apt-repository ppa:oibaf/graphics-drivers -y
apt update
apt install --only-upgrade libgl1-mesa-dev
apt install --only-upgrade libglu1-mesa-dev
apt install --only-upgrade mesa-common-dev
apt install --only-upgrade libosmesa6-dev

0 comments on commit 02671b1

Please sign in to comment.