Files
minicalosim/docker/Dockerfile
T
lars 4ffb2f78b8 extend Steps ntuple and switch Docker to Geant4 submodule source
Add 15 new columns to the Steps ntuple: edep, step_length, parent_id,
process name, layer_id, material, pre-step momentum direction, and
B/E field components (in T and V/m) at the pre-step point.

Replace wget Geant4 tarball download in all three Dockerfiles with
ADD of the lib/geant4 submodule source; narrow submodule init to
lib/pybind11 only so builds no longer require network access for Geant4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 16:07:17 +02:00

137 lines
4.4 KiB
Docker

FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
SHELL ["/bin/sh", "-c"]
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN /usr/bin/ls
RUN sed -i "s,# deb http://archive.canonical.com/ubuntu,deb http://archive.canonical.com/ubuntu,g" /etc/apt/sources.list
## Install some deps
#RUN ls /etc/apt/
RUN apt-get update -y
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y python3 python3-dev python3-venv python3-pip
#RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 100
RUN apt-get install -y dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev libssl-dev
#RUN python3 --version && python3 -m ensurepip
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install pandas numpy matplotlib MarkupSafe wandb uproot setuptools awkward-pandas plotly
RUN python3 -m pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
RUN python3 -m pip install torch_geometric
RUN python3 -m pip install torch-cluster -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
# # # # GEANT
RUN apt-get -y install libxmu-dev \
libgl1-mesa-dev \
libxerces-c-dev \
libexpat1 \
libx11-dev \
libglu1-mesa-dev \
freeglut3-dev \
mesa-common-dev \
imagemagick \
gv wget autotools-dev libicu-dev libbz2-dev
## DAWN FOR VIS
RUN mkdir dawn-source \
&& wget -q -O - http://geant4.kek.jp/~tanaka/src/dawn_3_91a.tgz | tar xzf - -C "dawn-source" \
&& export DAWN_PS_PREVIEWER=NONE && cd dawn-source/dawn_3_91a \
&& make clean && make guiclean && make && make install \
&& cd - && rm -rf "dawn-source"
## main package — build Geant4 from submodule source
ADD minicalosim/lib/geant4 /tmp/geant4-src
RUN cmake \
-S /tmp/geant4-src \
-B /tmp/geant4-build \
-DCMAKE_INSTALL_PREFIX=/opt/geant4-v11.1.2 \
-DCMAKE_RULE_MESSAGES=OFF \
-DGEANT4_INSTALL_DATA=ON \
-DGEANT4_USE_GDML=ON \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_BUILD_MULTITHREADED=OFF \
-DGEANT4_BUILD_TLS_MODEL=global-dynamic \
-DGEANT4_USE_RAYTRACER_X11=ON \
>/dev/null && \
cmake --build /tmp/geant4-build --parallel $(nproc) >/dev/null && \
cmake --install /tmp/geant4-build >/dev/null && \
rm -rf /tmp/geant4-src /tmp/geant4-build
RUN python3 -m pip install geant4-pybind
ENV LD_LIBRARY_PATH="/opt/geant4-v11.1.2/lib:${LD_LIBRARY_PATH}"
RUN apt-get install -y git
RUN python3 -m pip install ipython
RUN apt-get install -y tk # for dawn
# add jupyter packages for UC2 on top so they don't need to be installed every time
RUN python3 -m pip install jupyterlab jupyterhub==4.1.5 batchspawner
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN python3 -m pip install torch-scatter -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
#finally the package; use the commit hash to check out the correct version and only get them here, such that the rest can be cached
ARG BUILD_DATE
LABEL org.label-schema.build-date=$BUILD_DATE
ARG COMMIT
ARG USER
# copy minicalosim and checkout the correct commit
ADD minicalosim /root/minicalosim
RUN cd /root/minicalosim && git checkout $COMMIT && \
git submodule update --init lib/pybind11 && \
mkdir -p build && cd build && rm -rf * && cmake ../ && make -j4
RUN cp /root/minicalosim/build/minicalo* /root/minicalosim/bind/G4Calo.py /root/minicalosim/bind/minicalo_tools.py /root/minicalosim/bind/minipandas.py /usr/local/lib/python3.10/dist-packages/
RUN cp /root/minicalosim/bind/G4Calo_exec.py /usr/local/bin/
RUN cp -r /root/minicalosim/bind /examples
RUN cp /root/minicalosim/docker/start-notebook.py /usr/local/bin/
RUN cp /root/minicalosim/docker/start-notebook.sh /usr/local/bin/
RUN cp /root/minicalosim/docker/start-singleuser.py /usr/local/bin/
RUN cp /root/minicalosim/docker/start-singleuser.sh /usr/local/bin/
RUN cp /root/minicalosim/docker/fix-permissions /usr/local/bin/
RUN cp /root/minicalosim/docker/check_cuda_torch.py /usr/local/bin/
ARG NB_USER="jovyan"
ARG NB_UID="1000"
ARG NB_GID="100"
USER root
#RUN groupadd -g ${NB_GID} ${NB_USER} && \
RUN useradd -m -s /bin/bash -N -u ${NB_UID} -g ${NB_GID} ${NB_USER}
RUN mkdir /etc/jupyter
RUN fix-permissions /etc/jupyter/
# clean up
RUN rm -rf /root/minicalosim
RUN pip3 install pyarrow fastparquet
USER ${NB_UID}
CMD ["bash"]