diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..756d9b4 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,68 @@ +FROM ubuntu:24.04 + +ARG DEBIAN_FRONTEND=noninteractive + +# --------------------------------------------------------------------------- +# System dependencies (dnf instead of apt) +# --------------------------------------------------------------------------- +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + make \ + cmake \ + ninja-build \ + libxerces-c-dev \ + git \ + curl \ + ca-certificates \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv \ + && rm -rf /var/lib/apt/lists/* +# --------------------------------------------------------------------------- +# uv +# --------------------------------------------------------------------------- +RUN curl -LsSf https://astral.sh/uv/install.sh | sh +ENV PATH="/root/.local/bin:${PATH}" + +WORKDIR /src + +# --------------------------------------------------------------------------- +# Copy only files needed for the C++ build +# --------------------------------------------------------------------------- +COPY CMakeLists.txt . +COPY superbuild/ superbuild/ +COPY src/ src/ +COPY include/ include/ +COPY bind/ bind/ +COPY lib/ lib/ +COPY run_pbwo4.cc . + +# lib/geant4/.git is a submodule pointer to the host's .git/modules dir, which +# is not copied into the image. Replace it with a fresh repo so Geant4's cmake +# git status calls succeed. +RUN rm lib/geant4/.git && git init lib/geant4 + +# --------------------------------------------------------------------------- +# Build Geant4 + miniCaloSim +# --------------------------------------------------------------------------- +RUN cmake -S superbuild -B build -G Ninja \ + -DGEANT4_INSTALL_DATA=ON + +RUN cmake --build build --parallel + +# --------------------------------------------------------------------------- +# Python environment (uv) +# --------------------------------------------------------------------------- +RUN uv venv /opt/venv + +ENV PATH="/opt/venv/bin:${PATH}" + +ADD docker/pyproject.toml pyproject.toml + +RUN uv sync + +WORKDIR /workspace + +ENTRYPOINT ["/bin/bash", "-l"] \ No newline at end of file diff --git a/docker/Dockerfile-mini b/docker/Dockerfile-mini deleted file mode 100644 index 7a45b7c..0000000 --- a/docker/Dockerfile-mini +++ /dev/null @@ -1,68 +0,0 @@ -FROM ubuntu:22.04 - -SHELL ["/bin/bash", "-c"] - -USER root -ENV DEBIAN_FRONTEND=noninteractive - -# Build tools + minimal Python -RUN apt-get update -y && apt-get install -y \ - python3 python3-dev python3-pip \ - cmake g++ gcc binutils \ - libssl-dev wget git \ - && rm -rf /var/lib/apt/lists/* - -RUN python3 -m pip install --upgrade pip && \ - python3 -m pip install numpy pandas uproot awkward plotly ipython && \ - ln -sf /usr/bin/python3 /usr/bin/python - -# Geant4 — build from submodule source (batch mode only, no visualization, no multithreading) -ADD minicalosim/lib/geant4 /tmp/geant4-src - -RUN rm -f /tmp/geant4-src/.git && \ - 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_BUILD_MULTITHREADED=OFF \ - -DGEANT4_BUILD_TLS_MODEL=global-dynamic \ - > /dev/null && \ - cmake --build /tmp/geant4-build --parallel $(( $(nproc) < 16 ? $(nproc) : 16 )) > /dev/null && \ - cmake --install /tmp/geant4-build > /dev/null && \ - rm -rf /tmp/geant4-src /tmp/geant4-build - -ENV LD_LIBRARY_PATH="/opt/geant4-v11.1.2/lib" - -# Build minicalo -ARG BUILD_DATE -ARG COMMIT -ARG USER -LABEL org.label-schema.build-date=$BUILD_DATE - -ADD minicalosim /root/minicalosim - -RUN cd /root/minicalosim && git checkout $COMMIT && \ - git submodule update --init lib/pybind11 && \ - cmake \ - -S . -B build \ - -DWITH_GEANT4_UIVIS=OFF \ - > /dev/null && \ - cmake --build build --parallel $(( $(nproc) < 16 ? $(nproc) : 16 )) && \ - cp build/minicalo*.so /usr/local/lib/python3.10/dist-packages/ - -RUN echo "commit = '${COMMIT}'" > /root/minicalosim/bind/minicalo_version.py && \ - cp /root/minicalosim/bind/G4Calo.py \ - /root/minicalosim/bind/minicalo_tools.py \ - /root/minicalosim/bind/minipandas.py \ - /root/minicalosim/bind/minicalo_version.py \ - /usr/local/lib/python3.10/dist-packages/ && \ - install -m 755 /root/minicalosim/bind/G4Calo_exec.py /usr/local/bin/G4Calo_exec.py - -# Copy examples -RUN cp -r /root/minicalosim/bind /examples && \ - rm -rf /root/minicalosim - -WORKDIR /examples -CMD ["bash"] diff --git a/docker/pyproject.toml b/docker/pyproject.toml new file mode 100644 index 0000000..89a6ab0 --- /dev/null +++ b/docker/pyproject.toml @@ -0,0 +1,21 @@ +[project] +name = "minicalosim" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.14" +dependencies = [ + "awkward>=2.9.1", + "awkward-pandas>=2023.8.0", + "hist>=2.10.1", + "jupyter>=1.1.1", + "matplotlib>=3.10.9", + "mplhep>=1.2.0", + "networkx>=3.6.1", + "numpy>=2.4.6", + "pandas>=3.0.3", + "plotly>=6.8.0", + "polars>=1.41.2", + "seaborn>=0.13.2", + "uproot>=5.7.4", +]