-
Notifications
You must be signed in to change notification settings - Fork 10
add dockerfile for docker image with dagmc, openmc, pyne and fusion-material-db #11
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
af7d182
cbfe3fd
91cad5c
a8849c4
bd0ba25
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 | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,147 @@ | ||||||||
FROM debian:bookworm-slim | ||||||||
|
||||||||
ARG cores=1 | ||||||||
|
||||||||
ENV HOME=/root | ||||||||
|
||||||||
# Embree variables | ||||||||
ENV EMBREE_TAG='v4.3.1' | ||||||||
ENV EMBREE_REPO='https://github.com/embree/embree' | ||||||||
ENV EMBREE_INSTALL_DIR=$HOME/EMBREE | ||||||||
|
||||||||
# MOAB variables | ||||||||
ENV MOAB_TAG='5.5.1' | ||||||||
ENV MOAB_REPO='https://bitbucket.org/fathomteam/moab/' | ||||||||
|
||||||||
# Double-Down variables | ||||||||
ENV DD_TAG='v1.1.0' | ||||||||
ENV DD_REPO='https://github.com/pshriwise/double-down' | ||||||||
ENV DD_INSTALL_DIR=$HOME/Double_down | ||||||||
|
||||||||
# DAGMC variables | ||||||||
ENV DAGMC_BRANCH='v3.2.4' | ||||||||
ENV DAGMC_REPO='https://github.com/svalinn/DAGMC' | ||||||||
ENV DAGMC_INSTALL_DIR=$HOME/DAGMC | ||||||||
|
||||||||
# OpenMC variables | ||||||||
ENV OPENMC_BRANCH="develop" | ||||||||
ENV OPENMC_REPO='https://github.com/openmc-dev/openmc' | ||||||||
ENV OPENMC_INSTALL_DIR=$HOME/OpenMC | ||||||||
|
||||||||
# PyNE variables | ||||||||
ENV PYNE_VERSION="0.7.8" | ||||||||
|
||||||||
# Install and update dependencies from Debian package manager | ||||||||
RUN apt-get update -y && \ | ||||||||
apt-get upgrade -y && \ | ||||||||
apt-get install -y \ | ||||||||
python3-pip python-is-python3 wget git build-essential cmake \ | ||||||||
mpich libmpich-dev libhdf5-serial-dev libhdf5-mpich-dev libffi-dev \ | ||||||||
libpng-dev python3-venv curl libblas-dev liblapack-dev libbz2-dev \ | ||||||||
libeigen3-dev libnetcdf-dev libtbb-dev libglfw3-dev liblzma-dev libssl-dev \ | ||||||||
zlib1g-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev \ | ||||||||
libxml2-dev libxmlsec1-dev && \ | ||||||||
apt-get autoremove | ||||||||
|
||||||||
ENV PYTHON_VERSION=3.11.9 | ||||||||
|
||||||||
# Set-up necessary Env vars for PyEnv. PyNE likes this python version. | ||||||||
ENV PYENV_ROOT=/root/.pyenv | ||||||||
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH | ||||||||
|
||||||||
# Install pyenv & python dependencies. | ||||||||
RUN set -ex \ | ||||||||
&& curl https://pyenv.run | bash \ | ||||||||
&& pyenv install $PYTHON_VERSION \ | ||||||||
&& pyenv global $PYTHON_VERSION \ | ||||||||
&& pyenv rehash \ | ||||||||
&& pip install --upgrade pip \ | ||||||||
&& pip install packaging \ | ||||||||
progress pyyaml pytest openmc-plasma-source vtk tables | ||||||||
|
||||||||
# Install addition packages required for DAGMC | ||||||||
# PyNE currently requires these versions of cython and numpy | ||||||||
RUN pip install --upgrade numpy "cython<3.0" "numpy<2.0" | ||||||||
# Clone and install EMBREE | ||||||||
RUN mkdir -p $HOME/EMBREE && cd $HOME/EMBREE \ | ||||||||
&& git clone --single-branch -b ${EMBREE_TAG} --depth 1 ${EMBREE_REPO} \ | ||||||||
&& mkdir build && cd build \ | ||||||||
&& cmake ../embree \ | ||||||||
-DCMAKE_INSTALL_PREFIX=${EMBREE_INSTALL_DIR} \ | ||||||||
-DEMBREE_MAX_ISA=NONE \ | ||||||||
-DEMBREE_ISA_SSE42=ON \ | ||||||||
-DEMBREE_ISPC_SUPPORT=OFF \ | ||||||||
&& make 2>/dev/null -j${cores} install \ | ||||||||
&& rm -rf ${EMBREE_INSTALL_DIR}/build ${EMBREE_INSTALL_DIR}/embree | ||||||||
|
||||||||
# Clone and install MOAB | ||||||||
RUN mkdir -p $HOME/MOAB && cd $HOME/MOAB \ | ||||||||
&& git clone --single-branch -b ${MOAB_TAG} --depth 1 ${MOAB_REPO} \ | ||||||||
&& mkdir build && cd build \ | ||||||||
&& cmake ../moab -DENABLE_HDF5=ON \ | ||||||||
-DENABLE_NETCDF=ON \ | ||||||||
-DBUILD_SHARED_LIBS=ON \ | ||||||||
-DENABLE_FORTRAN=OFF \ | ||||||||
-DENABLE_BLASLAPACK=ON \ | ||||||||
&& make 2>/dev/null -j${cores} install \ | ||||||||
&& cmake ../moab \ | ||||||||
-DENABLE_PYMOAB=ON \ | ||||||||
-DBUILD_SHARED_LIBS=ON \ | ||||||||
&& make 2>/dev/null -j${cores} install \ | ||||||||
&& cd pymoab && bash install.sh \ | ||||||||
&& python setup.py install \ | ||||||||
&& python -c "import pymoab" \ | ||||||||
&& ldconfig | ||||||||
|
||||||||
# Clone and install Double-Down | ||||||||
RUN mkdir -p $HOME/Double_down && cd $HOME/Double_down \ | ||||||||
&& git clone --single-branch -b ${DD_TAG} --depth 1 ${DD_REPO} \ | ||||||||
&& mkdir build && cd build \ | ||||||||
&& cmake ../double-down -DCMAKE_INSTALL_PREFIX=${DD_INSTALL_DIR} \ | ||||||||
-DMOAB_DIR=/usr/local \ | ||||||||
-DEMBREE_DIR=${EMBREE_INSTALL_DIR} \ | ||||||||
&& make 2>/dev/null -j${cores} install \ | ||||||||
&& rm -rf ${DD_INSTALL_DIR}/build ${DD_INSTALL_DIR}/double-down | ||||||||
|
||||||||
# Clone and install DAGMC | ||||||||
RUN mkdir -p $HOME/DAGMC && cd $HOME/DAGMC \ | ||||||||
&& git clone --single-branch -b ${DAGMC_BRANCH} --depth 1 ${DAGMC_REPO} \ | ||||||||
&& mkdir build && cd build \ | ||||||||
&& cmake ../DAGMC -DBUILD_TALLY=ON \ | ||||||||
-DCMAKE_INSTALL_PREFIX=${DAGMC_INSTALL_DIR} \ | ||||||||
-DMOAB_DIR=/usr/local \ | ||||||||
-DDOUBLE_DOWN=ON \ | ||||||||
-DDOUBLE_DOWN_DIR=${DD_INSTALL_DIR} \ | ||||||||
-DCMAKE_PREFIX_PATH=${DD_INSTALL_DIR}/lib \ | ||||||||
-DBUILD_STATIC_LIBS=OFF \ | ||||||||
&& make 2>/dev/null -j${cores} install \ | ||||||||
&& rm -rf ${DAGMC_INSTALL_DIR}/DAGMC ${DAGMC_INSTALL_DIR}/build | ||||||||
ENV PATH=$PATH:${DAGMC_INSTALL_DIR}/bin | ||||||||
|
||||||||
# Clone and install OpenMC | ||||||||
RUN mkdir -p ${OPENMC_INSTALL_DIR} && cd ${OPENMC_INSTALL_DIR} \ | ||||||||
&& git clone --shallow-submodules --recurse-submodules --single-branch -b ${OPENMC_BRANCH} --depth=1 ${OPENMC_REPO} \ | ||||||||
&& mkdir build && cd build \ | ||||||||
&& cmake ../openmc \ | ||||||||
-DCMAKE_CXX_COMPILER=mpicxx \ | ||||||||
-DOPENMC_USE_MPI=on \ | ||||||||
-DHDF5_PREFER_PARALLEL=on \ | ||||||||
-DOPENMC_USE_DAGMC=ON \ | ||||||||
-DCMAKE_PREFIX_PATH=${DAGMC_INSTALL_DIR} \ | ||||||||
&& make 2>/dev/null -j${cores} install \ | ||||||||
&& cd ../openmc && pip install .[test,depletion-mpi] \ | ||||||||
&& python -c "import openmc" | ||||||||
|
||||||||
RUN mkdir -p $HOME/opt | ||||||||
WORKDIR $HOME/opt | ||||||||
RUN git clone -b ${PYNE_VERSION} https://github.com/pyne/pyne.git | ||||||||
RUN cd $HOME/opt/pyne \ | ||||||||
&& python setup.py install --user --clean -j${cores} | ||||||||
RUN ./pyne/scripts/nuc_data_make | ||||||||
|
||||||||
RUN git clone https://github.com/svalinn/fusion-material-db.git | ||||||||
ENV PYTHONPATH=$PYTHONPATH:$HOME/opt/fusion-material-db/material-db-tools | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Either define the variable before or get rid of the line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yikes! Won't this remove default values of PYTHONPATH? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PYTHONPATH is empty by default, docker gives a build warning about using an undefined variable as written, this suggestion is to resolve the warning. Another alternative would be to just do
But I think I like defining PYTHONPATH as an empty string elsewhere so we can maintain the convention of appending all additions to PYTHONPATH to itself. Not a big deal since we only add one thing to it in this dockerfile, but if more things needed to be added it would be convenient to not worry about whether you are changing the first place it is declared. Or we could just ignore the warning. |
||||||||
|
||||||||
WORKDIR / | ||||||||
|
||||||||
|
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.
Might be helpful to add a comment for what this line is useful for (for posterity)