diff --git a/docker/Dockerfile b/docker/Dockerfile index e956741..cb19bfc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,8 @@ FROM ubuntu:latest MAINTAINER Huy Duc Vo +ARG pacmensl_version=0.1.0 + RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN apt-get update && \ @@ -9,7 +11,8 @@ RUN apt-get update && \ RUN apt-get -y install dialog apt-utils # set environment variables -ENV USERNAME huy +ENV USERNAME user +ENV PACMENSL_VERSION $pacmensl_version RUN adduser --disabled-password --gecos --create-home ${USERNAME} RUN adduser ${USERNAME} sudo @@ -41,7 +44,6 @@ ENV PACKAGES="\ RUN sudo apt-get install -y ${PACKAGES} && sudo apt-get clean - RUN sudo echo "export LD_LIBRARY_PATH=/usr/local/lib" >> /home/${USERNAME}/.bashrc && \ mkdir /home/${USERNAME}/software && \ mkdir /home/${USERNAME}/software/src && \ @@ -74,3 +76,27 @@ RUN sudo chmod +x ./install_conda.sh && ./install_conda.sh \ && \ conda update conda && \ conda init bash + +# install petsc +COPY install_scripts/install_petsc.sh ./ +RUN sudo chmod +x ./install_petsc.sh && ./install_petsc.sh + +## install sundials +COPY install_scripts/install_sundials.sh ./ +ENV PETSC_DIR=/home/${USERNAME}/software/install/petsc +ENV PETSC_ARCH=linux-c-opt +RUN sudo chmod +x ./install_sundials.sh && ./install_sundials.sh + +# install pacmensl +COPY install_scripts/install_pacmensl.sh ./ +ENV CPATH=/home/${USERNAME}/software/install/include +ENV LIBRARY_PATH=/home/${USERNAME}/software/install/lib +RUN sudo chmod +x ./install_pacmensl.sh && ./install_pacmensl.sh + +# Set OMPI environment variable to prevent spurious printing, see issue 4948 openmpi github page +ENV OMPI_MCA_btl_vader_single_copy_mechanism=none + +# Cleanup +RUN sudo rm *.sh && \ + sudo rm -rf /home/${USERNAME}/software/build && \ + sudo rm -rf /home/${USERNAME}/software/src diff --git a/docker/build_docker_image.sh b/docker/build_docker_image.sh new file mode 100755 index 0000000..92ff3c5 --- /dev/null +++ b/docker/build_docker_image.sh @@ -0,0 +1,4 @@ +PACMENSL_VERSION=0.1.0 +ARCH=$(uname -m) + +docker build -t pacmensl:v${PACMENSL_VERSION}_${ARCH} --build-arg pacmensl_version=$PACMENSL_VERSION . \ No newline at end of file diff --git a/docker/install_scripts/install_pacmensl.sh b/docker/install_scripts/install_pacmensl.sh index 4c960f9..cae4dfa 100755 --- a/docker/install_scripts/install_pacmensl.sh +++ b/docker/install_scripts/install_pacmensl.sh @@ -4,7 +4,10 @@ user=${USERNAME} export CPATH=${CPATH};/home/${user}/software/install/include cd /home/${user}/software/src -git clone https://github.com/voduchuy/pacmensl pacmensl +wget https://github.com/voduchuy/pacmensl/archive/refs/tags/v${PACMENSL_VERSION}.tar.gz -O pacmensl.tar.gz +tar -xf pacmensl.tar.gz +rm *.tar.gz +mv pacmensl* pacmensl cd /home/${user}/software/build mkdir pacmensl @@ -14,7 +17,4 @@ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_POSITION_INDPEND make -j4 # Now install -make install - -# Cleanup all redundant dependencies -rm -rf /home/${user}/software/src \ No newline at end of file +make install \ No newline at end of file