-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,29 @@ | ||
FROM ubuntu:latest | ||
FROM continuumio/miniconda3:latest | ||
|
||
# Install dependencies and upgrade | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential bzip2 ca-certificates curl git mesa-common-dev libglu1-mesa-dev python3-dev \ | ||
&& apt-get upgrade -y \ | ||
RUN apt-get update -qq && apt-get install -q -y --no-install-recommends \ | ||
build-essential libxerces-c-dev \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install miniconda and activate base on startup | ||
ENV PATH /opt/conda/bin:/opt/conda/condabin:${PATH} | ||
ENV CMAKE_PREFIX_PATH=/opt/conda | ||
|
||
RUN curl -o miniconda_installer.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||
&& bash miniconda_installer.sh -b -p /opt/conda \ | ||
&& rm miniconda_installer.sh \ | ||
&& conda install -y -c conda-forge mamba \ | ||
&& mamba init bash \ | ||
&& mamba config --set auto_activate_base true \ | ||
&& mamba clean -ya | ||
|
||
# Install conda packages (geant4 is not available for aarch64 at the time of writing) | ||
RUN mamba install -y -c conda-forge geant4 \ | ||
# remove data package to reduce image size (we should not install them in the first place, how?) | ||
# && mamba remove -y $(mamba list | grep 'geant4-data' | awk '{print $1}') \ | ||
# && rm -rf /opt/conda/share/Geant4/data/* \ | ||
&& mamba clean -ya | ||
|
||
# Copy files | ||
# Need a more recent version of cmake | ||
RUN conda install -y cmake | ||
|
||
ARG CMAKE_CXX_STANDARD=20 | ||
ARG GEANT4_VERSION=v11.1.3 | ||
|
||
RUN git clone https://github.com/Geant4/geant4.git /tmp/geant4 --branch=${GEANT4_VERSION} --depth=1 \ | ||
&& cmake -B /tmp/geant4/build -S /tmp/geant4 -DCMAKE_INSTALL_PREFIX=/usr/local/ -DCMAKE_CXX_STANDARD=$CMAKE_CXX_STANDARD \ | ||
-DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=OFF -DGEANT4_INSTALL_EXAMPLES=OFF -DGEANT4_USE_GDML=ON \ | ||
-DGEANT4_BUILD_STORE_TRAJECTORY=OFF -DGEANT4_BUILD_VERBOSE_CODE=OFF \ | ||
&& cmake --build /tmp/geant4/build -j$(nproc) --target install \ | ||
&& rm -rf /tmp/geant4 | ||
|
||
# RUN geant4-config --instal-datasets | ||
|
||
COPY . /source | ||
|
||
# Build and install | ||
RUN cd source && python -m pip install . | ||
|
||
RUN echo "#!/bin/bash\nexec /opt/conda/bin/conda run --no-capture-output -n base /opt/conda/bin/python \"\$@\"" > /usr/local/bin/entrypoint.sh \ | ||
&& chmod +x /usr/local/bin/entrypoint.sh | ||
RUN pip install /source && rm -rf /source | ||
|
||
# Set the entry point to the script | ||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] | ||
ENTRYPOINT ["python"] |