-
Notifications
You must be signed in to change notification settings - Fork 3
build(docker): split Geant4 source build and physics data installation #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,25 @@ FROM nvidia/cuda:${CUDA_VERSION}-devel-${OS} AS base | |||||||||||||||||||||||
| ARG OPTIX_VERSION=9.0.0 | ||||||||||||||||||||||||
| ARG GEANT4_VERSION=11.3.2 | ||||||||||||||||||||||||
| ARG CMAKE_VERSION=4.2.1 | ||||||||||||||||||||||||
| ARG CMAKE_BUILD_JOBS=4 | ||||||||||||||||||||||||
| ARG GEANT4_INSTALL_DATA=ON | ||||||||||||||||||||||||
| ARG GEANT4_DATA_URL=https://geant4-data.web.cern.ch/datasets | ||||||||||||||||||||||||
| ARG GEANT4_DATASETS="\ | ||||||||||||||||||||||||
| G4NDL.4.7.1.tar.gz \ | ||||||||||||||||||||||||
| G4EMLOW.8.6.1.tar.gz \ | ||||||||||||||||||||||||
| G4PhotonEvaporation.6.1.tar.gz \ | ||||||||||||||||||||||||
| G4RadioactiveDecay.6.1.2.tar.gz \ | ||||||||||||||||||||||||
| G4PARTICLEXS.4.1.tar.gz \ | ||||||||||||||||||||||||
| G4PII.1.3.tar.gz \ | ||||||||||||||||||||||||
| G4RealSurface.2.2.tar.gz \ | ||||||||||||||||||||||||
| G4SAIDDATA.2.0.tar.gz \ | ||||||||||||||||||||||||
| G4ABLA.3.3.tar.gz \ | ||||||||||||||||||||||||
| G4INCL.1.2.tar.gz \ | ||||||||||||||||||||||||
| G4ENSDFSTATE.3.0.tar.gz \ | ||||||||||||||||||||||||
| G4CHANNELING.1.0.tar.gz \ | ||||||||||||||||||||||||
| G4TENDL.1.4.tar.gz \ | ||||||||||||||||||||||||
| G4NUDEXLIB.1.0.tar.gz \ | ||||||||||||||||||||||||
| G4URRPT.1.1.tar.gz" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ENV DEBIAN_FRONTEND=noninteractive | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -28,10 +47,17 @@ RUN curl -fsSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSI | |||||||||||||||||||||||
| | tar -xz --strip-components=1 -C /usr/local | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| RUN mkdir -p /opt/geant4/src && curl -sL https://github.com/Geant4/geant4/archive/refs/tags/v${GEANT4_VERSION}.tar.gz | tar -xz --strip-components 1 -C /opt/geant4/src \ | ||||||||||||||||||||||||
| && cmake -S /opt/geant4/src -B /opt/geant4/build -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_QT_QT6=ON -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_BUILD_MULTITHREADED=ON \ | ||||||||||||||||||||||||
| && cmake --build /opt/geant4/build --parallel --target install \ | ||||||||||||||||||||||||
| && cmake -S /opt/geant4/src -B /opt/geant4/build -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_QT_QT6=ON -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=OFF -DGEANT4_INSTALL_DATADIR=share/Geant4/data -DGEANT4_BUILD_MULTITHREADED=ON \ | ||||||||||||||||||||||||
| && cmake --build /opt/geant4/build --parallel ${CMAKE_BUILD_JOBS} --target install \ | ||||||||||||||||||||||||
| && rm -fr /opt/geant4 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| RUN if [ "${GEANT4_INSTALL_DATA}" = "ON" ]; then \ | ||||||||||||||||||||||||
| mkdir -p /usr/local/share/Geant4/data; \ | ||||||||||||||||||||||||
| for dataset in ${GEANT4_DATASETS}; do \ | ||||||||||||||||||||||||
| curl -fsSL "${GEANT4_DATA_URL}/${dataset}" | tar -xz -C /usr/local/share/Geant4/data; \ | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| curl -fsSL "${GEANT4_DATA_URL}/${dataset}" | tar -xz -C /usr/local/share/Geant4/data; \ | |
| dataset_url="${GEANT4_DATA_URL}/${dataset}"; \ | |
| tmp_archive="/tmp/${dataset}"; \ | |
| curl -fsSL "${dataset_url}" -o "${tmp_archive}"; \ | |
| checksum_var_name="GEANT4_SHA256_$(echo "${dataset}" | tr '.-' '_' | tr '[:lower:]' '[:upper:]')"; \ | |
| expected_checksum=$(eval "printf '%s' \"\${${checksum_var_name}:-}\""); \ | |
| if [ -n "${expected_checksum}" ]; then \ | |
| echo "${expected_checksum} ${tmp_archive}" | sha256sum -c -; \ | |
| fi; \ | |
| tar -xzf "${tmp_archive}" --no-same-owner --no-same-permissions -C /usr/local/share/Geant4/data; \ | |
| rm -f "${tmp_archive}"; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GEANT4_DATASETSis pinned to specific dataset versions whileGEANT4_VERSIONremains configurable. If someone overridesGEANT4_VERSIONat build time, this list can become inconsistent with the chosen Geant4 release. Consider either tying the dataset list toGEANT4_VERSION(version-specific defaults) or documenting that overridingGEANT4_VERSIONrequires also overridingGEANT4_DATASETS.