diff --git a/Dockerfile b/Dockerfile index 76b75150a1..b68c77acfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,9 +24,6 @@ ARG build_libmesh=off # By default one core is used to compile ARG compile_cores=1 -# Set default value of HOME to /root -ENV HOME /root - # OpenMC variables ARG openmc_branch=master ENV OPENMC_REPO='https://github.com/openmc-dev/openmc' @@ -50,16 +47,10 @@ ENV DAGMC_BRANCH='develop' ENV DAGMC_REPO='https://github.com/svalinn/DAGMC' ENV DAGMC_INSTALL_DIR=$HOME/DAGMC/ -# LIBMESH variables -ENV LIBMESH_TAG='v1.6.0' -ENV LIBMESH_REPO='https://github.com/libMesh/libmesh' -ENV LIBMESH_INSTALL_DIR=$HOME/LIBMESH - -# Creates the arguments for the openmc build command using parameter expansion -ENV OPENMC_CMAKE_ARGS="-Ddebug=on -Doptimize=on -DHDF5_PREFER_PARALLEL=on -Ddagmc=${build_dagmc} -DCMAKE_PREFIX_PATH=${DAGMC_INSTALL_DIR} -Dlibmesh=${build_libmesh} -DCMAKE_PREFIX_PATH=${LIBMESH_INSTALL_DIR}" - # Setup environment variables for Docker image ENV CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \ + PATH=/miniconda/bin:${PATH} \ + LIBMESH_DIR=/miniconda/libmesh \ LD_LIBRARY_PATH=${DAGMC_INSTALL_DIR}/lib:$LD_LIBRARY_PATH \ OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml \ OPENMC_ENDF_DATA=/root/endf-b-vii.1 \ @@ -74,6 +65,7 @@ RUN apt-get update -y && \ libpng-dev && \ apt-get autoremove + # Update system-provided pip RUN pip install --upgrade pip @@ -83,7 +75,6 @@ RUN cd $HOME && git clone --depth 1 https://github.com/njoy/NJOY2016.git && \ cmake -Dstatic=on .. && make 2>/dev/null -j${compile_cores} install ; \ rm -rf $HOME/NJOY2016 - RUN if [ "$build_dagmc" = "on" ]; then \ # Install addition packages required for DAGMC apt-get -y install libeigen3-dev libnetcdf-dev libtbb-dev libglfw3-dev ; \ @@ -138,35 +129,56 @@ RUN if [ "$build_dagmc" = "on" ]; then \ rm -rf ${DAGMC_INSTALL_DIR}/DAGMC ${DAGMC_INSTALL_DIR}/build ; \ fi - RUN if [ "$build_libmesh" = "on" ]; then \ - # Install addition packages required for LIBMESH - apt-get -y install m4 libnetcdf-dev libpnetcdf-dev ; \ - # Install LIBMESH - mkdir -p $HOME/LIBMESH && cd $HOME/LIBMESH ; \ - git clone --shallow-submodules --recurse-submodules --single-branch -b ${LIBMESH_TAG} --depth 1 ${LIBMESH_REPO} ; \ - mkdir build && cd build ; \ - ../libmesh/configure \ - --prefix=${LIBMESH_INSTALL_DIR} CXX=mpicxx CC=mpicc FC=mpifort F77=mpif77 \ - --enable-exodus \ - --disable-netcdf-4 \ - --disable-eigen \ - --disable-fortran \ - --disable-lapack \ - --enable-hdf5 \ - --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/ \ - --enable-mpi ; \ - make 2>/dev/null -j${compile_cores} install ; \ - rm -rf ${LIBMESH_INSTALL_DIR}/build ${LIBMESH_INSTALL_DIR}/libmesh ; \ + # Install miniconda + wget -q https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh -O miniconda.sh ; \ + bash miniconda.sh -b -p /miniconda ; \ + rm -f miniconda.sh ; \ + conda config --set always_yes yes --set changeps1 no ; \ + conda update -q conda ; \ + # Add INL public channel and install moose-libmesh + conda config --add channels conda-forge ; \ + conda config --add channels https://conda.software.inl.gov/public ; \ + conda install moose-libmesh ; \ fi # clone and install openmc -RUN mkdir -p $HOME/OpenMC && cd $HOME/OpenMC ; \ +RUN mkdir -p ${HOME}/OpenMC && cd ${HOME}/OpenMC ; \ git clone --shallow-submodules --recurse-submodules -b ${openmc_branch} --depth=1 ${OPENMC_REPO} ; \ - mkdir build && cd $HOME/OpenMC/build ; \ - cmake ../openmc "${OPENMC_CMAKE_ARGS}" ; \ + mkdir build && cd build ; \ + if [ ${build_dagmc} = "on" ] && [ ${build_libmesh} = "on" ]; then \ + cmake ../openmc \ + -Doptimize=on \ + -Ddebug=on \ + -DHDF5_PREFER_PARALLEL=on \ + -Ddagmc=on \ + -Dlibmesh=on \ + -DCMAKE_PREFIX_PATH="${DAGMC_INSTALL_DIR};${LIBMESH_DIR}" ; \ + fi ; \ + if [ ${build_dagmc} = "on" ] && [ ${build_libmesh} = "off" ]; then \ + cmake ../openmc \ + -Doptimize=on \ + -Ddebug=on \ + -DHDF5_PREFER_PARALLEL=on \ + -Ddagmc=ON \ + -DCMAKE_PREFIX_PATH=${DAGMC_INSTALL_DIR} ; \ + fi ; \ + if [ ${build_dagmc} = "off" ] && [ ${build_libmesh} = "on" ]; then \ + cmake ../openmc \ + -Doptimize=on \ + -Ddebug=on \ + -DHDF5_PREFER_PARALLEL=on \ + -Dlibmesh=on \ + -DCMAKE_PREFIX_PATH=${LIBMESH_DIR} ; \ + fi ; \ + if [ ${build_dagmc} = "off" ] && [ ${build_libmesh} = "off" ]; then \ + cmake ../openmc \ + -Doptimize=on \ + -Ddebug=on \ + -DHDF5_PREFER_PARALLEL=on ; \ + fi ; \ make 2>/dev/null -j${compile_cores} install ; \ cd ../openmc && pip install -e .[test] # Download cross sections (NNDC and WMP) and ENDF data needed by test suite -RUN $HOME/OpenMC/openmc/tools/ci/download-xs.sh +RUN ${HOME}/OpenMC/openmc/tools/ci/download-xs.sh