Skip to content
Snippets Groups Projects
Commit 1ccdf713 authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2:
Browse files

Merge branch 'ci-with-docker-g4-ubuntu' into 'main'

CI: Activate custom docker image with ubuntu 23.10 and geant4 11.2

See merge request !292
parents 9a142ef4 756348c1
No related branches found
No related tags found
1 merge request!292CI: Activate custom docker image with ubuntu 23.10 and geant4 11.2
Pipeline #7005189 passed
# List of the CI build stages.
stages:
- step-pre
- step-A
- step-B
- step-C
......@@ -47,7 +46,7 @@ workflow:
# general Ubuntu job template
.ubuntu-template-job-base: &ubuntu-job-base
image: ubuntu:22.04
image: gitlab-registry.cern.ch/geomodeldev/ubuntu-geant4-image:main-base
rules:
- when: always
......@@ -58,85 +57,9 @@ workflow:
# of the build, by using the 'standalone' job only
.ubuntu-template-job-default: &ubuntu-job
<<: *ubuntu-job-base
before_script:
- apt-get update -qq && apt-get install -y -qq apt-utils git wget unzip build-essential freeglut3-dev libboost-all-dev qtbase5-dev libqt5opengl5-dev mercurial libeigen3-dev libsqlite3-dev nlohmann-json3-dev libexpat1-dev libxerces-c-dev libhdf5-dev libhepmc3-dev cmake
# .ubuntu-template-job-registry: &ubuntu-job-registry
# image: gitlab-registry.cern.ch/mbandier/geant4-ubuntu/base-image:1.1
# before_script:
# - apt-get update -qq && apt-get install -y -qq libeigen3-dev libsqlite3-dev
# TEMPLATES FOR BUILDING PACKAGES
.coin-build-template: &coin-job
variables:
CMAKE_ARGS: ${CMAKE_DEPS_BASE_ARGS}
script:
- pwd; ls
- wget https://atlas-vp1.web.cern.ch/atlas-vp1/sources/coin-4.0.0-src.zip
- unzip coin-4.0.0-src.zip -d coin-sources
- mv coin-sources/* coin
- mkdir build_coin
- cd build_coin
- cmake ${CMAKE_ARGS} ../coin
- make -j2
- make install
artifacts:
paths:
- install
expire_in: 1 day
.soqt-build-template: &soqt-job
variables:
CMAKE_ARGS: ${CMAKE_DEPS_BASE_ARGS}
script:
- pwd; ls
- wget https://atlas-vp1.web.cern.ch/atlas-vp1/sources/soqt.zip
- unzip soqt.zip
- mkdir build_soqt
- cd build_soqt
- echo "CMAKE_ARGS - ${CMAKE_ARGS}"
- cmake ${CMAKE_ARGS} ../soqt
- make -j2
- make install
- pwd; ls # CI debug only
- ls ../ # CI debug only
- ls ../../ # CI debug only
artifacts:
paths:
- install
expire_in: 1 day
.geant4-build-template-job: &geant4-job
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
script:
- pwd; ls
- git clone https://gitlab.cern.ch/geant4/geant4.git
- cd geant4
- git checkout tags/v11.0.2
- cd ../
- mkdir Geant4-build
- cd Geant4-build
- ls;
- ls ../
- if [ -d "../install" ]; then ls ../install; fi
- cmake ${CMAKE_ARGS} -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_GDML=ON -DGEANT4_BUILD_MULTITHREADED=ON ../geant4
- make -j4
- make install
artifacts:
paths:
- install
expire_in: 1 day
.geomodel-build-template: &geomodel-job
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
......@@ -286,17 +209,6 @@ debug-job:
### These jobs build the various GeoModel sub-packages with the use of the CMake
### build options.
ubu-coin:
<<: *ubuntu-job
<<: *coin-job
stage: step-A
ubu-soqt:
<<: *ubuntu-job
<<: *soqt-job
stage: step-B
needs: ["ubu-coin"]
ubu-gm-base:
<<: *ubuntu-job
<<: *geomodel-job
......@@ -316,7 +228,6 @@ ubu-gm-tools:
ubu-gm-visualization:
<<: *ubuntu-job
<<: *geomodel-job
needs: ["ubu-coin", "ubu-soqt"]
stage: step-C
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
......@@ -331,18 +242,10 @@ ubu-gm-examples:
CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_EXAMPLES=TRUE
ubu-geant4:
<<: *ubuntu-job
<<: *geant4-job
stage: step-A
ubu-gm-examples-gmg4:
<<: *ubuntu-job
<<: *geomodel-job
stage: step-B
needs: ["ubu-geant4"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_EXAMPLES_W_GEANT4=TRUE
......@@ -351,7 +254,6 @@ ubu-gm-gmg4:
<<: *ubuntu-job
<<: *geomodel-job
stage: step-B
needs: ["ubu-geant4"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_GEOMODELG4=TRUE
......@@ -361,7 +263,6 @@ ubu-gm-fullsimlight:
<<: *ubuntu-job
<<: *geomodel-job
stage: step-B
needs: ["ubu-geant4"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_FULLSIMLIGHT=TRUE
......@@ -371,7 +272,6 @@ ubu-gm-fsl:
<<: *ubuntu-job
<<: *geomodel-job
stage: step-B
needs: ["ubu-geant4"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_FSL=TRUE
......@@ -381,7 +281,6 @@ ubu-gm-all:
<<: *ubuntu-job
<<: *geomodel-job
stage: step-C
needs: ["ubu-coin", "ubu-soqt", "ubu-geant4"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_ALL=TRUE
......@@ -395,7 +294,6 @@ ubu-gm-atlasextras:
<<: *ubuntu-job
<<: *geomodel-job
stage: step-B
needs: ["ubu-geant4"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_ATLASEXTENSIONS=TRUE
......@@ -405,7 +303,6 @@ ubu-gm-atlasextras:
# <<: *ubuntu-job
# <<: *geomodel-job
# stage: step-C
# needs: ["ubu-geant4"]
# variables:
# XERCESC_VERSION: 3.2.3
# CMAKE_ARGS: ${CMAKE_BASE_ARGS}
......@@ -462,7 +359,7 @@ ubu-single-gmtools:
ubu-single-gmviz:
<<: *ubuntu-job
stage: step-C
needs: ["ubu-single-gmbase", "ubu-soqt"]
needs: ["ubu-single-gmbase"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
script:
......@@ -479,7 +376,7 @@ ubu-single-gmviz:
ubu-single-gmg4:
<<: *ubuntu-job
stage: step-C
needs: ["ubu-single-gmbase", "ubu-geant4"]
needs: ["ubu-single-gmbase"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
script:
......@@ -496,7 +393,7 @@ ubu-single-gmg4:
ubu-single-gmfullsimlight:
<<: *ubuntu-job
stage: step-D
needs: ["ubu-single-gmg4", "ubu-geant4"]
needs: ["ubu-single-gmg4"]
variables:
CMAKE_ARGS: ${CMAKE_BASE_ARGS}
script:
......@@ -589,52 +486,19 @@ docs-deploy:
## - https://gitlab.cern.ch/gitlabci-examples/build_docker_image/-/blob/master/.gitlab-ci.yml#L11-27
## ---
# Build the 'base' image containing the system packages
# Build the 'full' docker image containing the system packages
## Note:
## - we build the docker image only from 'main' and tags
## - image's final name is, e.g., "geomodel:main-base"
## - image's final name is, e.g., "gitlab-registry.cern.ch/geomodeldev/geomodel:ci-with-docker-g4-ubuntu-full"
build_docker_system:
stage: step-A
only:
refs:
- main
- tags
variables:
# To push to a specific docker tag other than latest(the default), amend the --destination parameter, e.g. --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
# See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference for available variables
IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-base
# === Git-related variables
# all submodules will be cloned recursively upon start of CI job
GIT_SUBMODULE_STRATEGY: recursive
GIT_SSL_NO_VERIFY: "true"
image:
# The kaniko debug image is recommended because it has a shell, and a shell is required for an image to be used with GitLab CI/CD.
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
# Prepare Kaniko configuration file
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# Build and push the image from the Dockerfile at the root of the project.
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/CI/DockerfileBase --destination $IMAGE_DESTINATION
# Print the full registry path of the pushed image
- echo "Image pushed successfully to ${IMAGE_DESTINATION}"
## Build a Docker image containing Geant4, too
## (a quite large image, then!)
## Note:
## - we build the docker image only from 'main' and tags
## - image's final name is, e.g., "geomodel:main-full"
##
build_docker_full:
stage: step-B
allow_failure: true
needs:
- build_docker_system
timeout: 2h 0m
only:
refs:
- main
- tags
# rules:
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
variables:
# To push to a specific docker tag other than latest(the default), amend the --destination parameter, e.g. --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
# See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference for available variables
......@@ -651,58 +515,10 @@ build_docker_full:
# Prepare Kaniko configuration file
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# Build and push the image from the Dockerfile at the root of the project.
- /kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/CI/DockerfileFull
--destination $IMAGE_DESTINATION
--build-arg "BASEIMAGE=$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_NAME}-base"
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/CI/DockerfileFull --destination $IMAGE_DESTINATION
# Print the full registry path of the pushed image
- echo "Image pushed successfully to ${IMAGE_DESTINATION}"
## Build a Docker image for visualization pupose.
## This image does not contain
## FullSimLight or other Geant4-related packages.
## Note:
## - we build the docker image only from 'main' and tags
## - image's final name is, e.g., "geomodel:main-light"
##
build_docker_light:
stage: step-B
allow_failure: true
needs:
- build_docker_system
timeout: 2h 0m
only:
refs:
- main
- tags
variables:
# To push to a specific docker tag other than latest(the default), amend the --destination parameter, e.g. --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
# See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference for available variables
IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-light
# === Git-related variables
# all submodules will be cloned recursively upon start of CI job
GIT_SUBMODULE_STRATEGY: recursive
GIT_SSL_NO_VERIFY: "true"
image:
# The kaniko debug image is recommended because it has a shell, and a shell is required for an image to be used with GitLab CI/CD.
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
# Prepare Kaniko configuration file
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# Build and push the image from the Dockerfile at the root of the project.
- /kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/CI/DockerfileLight
--destination $IMAGE_DESTINATION
--build-arg "BASEIMAGE=$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_NAME}-base"
# Print the full registry path of the pushed image
- echo "Image pushed successfully to ${IMAGE_DESTINATION}"
##########
## TAGS ##
......
## Docker file to compile the very basic
## packages needed for GeoModel in order to avoid
## their duplication in the creation step of the
## Light and Full version
FROM ubuntu:23.04
USER root
WORKDIR /root
ARG XercesC_VERSION=3.2.3
ENV DEBIAN_FRONTEND noninteractive
### Install tzdata package
### During ordinary installation, the package
### wants to be configured. The additional commands
### circumvene the configuration on docker
RUN apt-get update && apt-get install -y tzdata && ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata
### Install C++, cmake and python
RUN apt-get update && apt-get install -y cmake g++ python-is-python3 git sudo nano wget
### Boost installation
RUN apt-get update && apt-get install -y libboost-all-dev
### Now we come to QT5 as a prerequiste of GeoModel
RUN apt-get update && apt-get install -y qtbase5-dev libqt5opengl5-dev
### Next install sqlite for the GeoModel outputs
RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev
### Install eigen to avoid the own installation
RUN apt-get update && apt-get install -y libeigen3-dev
### Install hdf5 to avoid the own installation
RUN apt-get update && apt-get install -y libhdf5-dev
### Install hepmc3 to avoid the own installation
RUN apt-get update && apt-get install -y libhepmc3-dev
### Another layer of building xer
RUN wget https://cern.ch/lcgpackages/tarFiles/sources/xerces-c-${XercesC_VERSION}.tar.gz && \
tar -xzf xerces-c-${XercesC_VERSION}.tar.gz && \
mkdir build && \
cd build && \
cmake ../xerces-c-${XercesC_VERSION} && \
make -j2 && \
make install && \
cd .. && \
rm -rf xerces-c-${XercesC_VERSION} build
### Last but very important, the installation of the OpenGL module
RUN apt-get update && apt-get install -y mesa-utils build-essential libgl1-mesa-dev
# Set up the ATLAS user, and give it super user rights.
RUN addgroup wheel && \
echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
adduser atlas && chmod 755 /home/atlas && \
usermod -aG wheel atlas && \
usermod -aG root atlas && \
mkdir /workdir && chown "atlas:atlas" /workdir && \
chmod 755 /workdir
USER atlas
WORKDIR /workdir
# Setup the most basic image
ARG BASEIMAGE=gitlab-registry.cern.ch/geomodeldev/geomodel:main-base
ARG BASEIMAGE=gitlab-registry.cern.ch/geomodeldev/ubuntu-geant4-image:main-base
FROM ${BASEIMAGE}
### First install Geant4 as we want to have the full functionallity
RUN git clone https://gitlab.cern.ch/geant4/geant4.git --branch 'v10.6.0' && \
mkdir build_geant4 && \
cd build_geant4 && \
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/geant4 -DCMAKE_BUILD_TYPE=Release -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_GDML=ON -DGEANT4_BUILD_MULTITHREADED=ON ../geant4/ &&\
make -j3 > /dev/null && \
sudo make install > /dev/null && \
cd .. && \
rm -rf build_geant4 geant4 && \
echo "#!/bin/bash" > ~/setup_docker.sh && \
echo "cd /usr/local/geant4/bin" >> ~/setup_docker.sh && \
echo "source geant4.sh" >> ~/setup_docker.sh && \
echo "cd -" >> ~/setup_docker.sh && \
sudo mv ~/setup_docker.sh /usr/local/geant4/setup_docker.sh && \
echo "source /usr/local/geant4/setup_docker.sh" >> ~/.bashrc
### Compile then geo model
COPY . /workdir/GeoModel_src/
RUN mkdir -p /workdir/build_geomodel/ && \
......
# Setup the most basic image
ARG BASEIMAGE=gitlab-registry.cern.ch/geomodeldev/geomodel:main-base
FROM ${BASEIMAGE}
COPY . /workdir/GeoModel_src/
RUN mkdir -p /workdir/build_geomodel/ && \
cd /workdir/build_geomodel/ && \
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/GeoModel -DGEOMODEL_BUILD_VISUALIZATION=1 -DGEOMODEL_USE_BUILTIN_JSON=1 -DGEOMODEL_BUILD_TOOLS=1 -DGEOMODEL_USE_BUILTIN_XERCESC=1 -DGEOMODEL_USE_BUILTIN_COIN3D=1 ../GeoModel_src/ && \
make -j2 && \
sudo make install && \
cd .. && \
sudo rm -rf build_geomodel GeoModel_src && \
echo "#!/bin/bash" > ~/setup_docker.sh && \
echo "export PATH=\"/usr/local/GeoModel/bin:\${PATH}\"" >> ~/setup_docker.sh && \
echo "export LD_LIBRARY_PATH=\"/usr/local/GeoModel/lib:\${LD_LIBRARY_PATH}\"" >> ~/setup_docker.sh && \
sudo mv ~/setup_docker.sh /usr/local/GeoModel/setup_docker.sh && \
echo "source /usr/local/GeoModel/setup_docker.sh" >> ~/.bashrc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment