Skip to content

Commit

Permalink
Modify Dockerfile to build image based on released PACMENSL versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
voduchuy committed Aug 14, 2021
1 parent c61bc31 commit 971c789
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
30 changes: 28 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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
Expand Down Expand Up @@ -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 && \
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions docker/build_docker_image.sh
Original file line number Diff line number Diff line change
@@ -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 .
10 changes: 5 additions & 5 deletions docker/install_scripts/install_pacmensl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
make install

0 comments on commit 971c789

Please sign in to comment.