Commit dbb2881c authored by Sarbani Roy's avatar Sarbani Roy
Browse files

Docker-related files added

parent 123843a4
build*
CMakeFiles
# Heck2020a docker container
# see https://github.com/phusion/baseimage-docker for information on the base image
# It is Ubuntu LTS customized for better Docker compatibility
FROM phusion/baseimage:focal-1.1.0
MAINTAINER katharina.heck@iws.uni-stuttgart.de
# run Ubuntu update as advised on https://github.com/phusion/baseimage-docker
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get upgrade -y -o Dpkg::Options::="--force-confold" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# install the basic dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends --yes \
ca-certificates \
vim \
python3-dev \
python3-pip \
git \
pkg-config \
cmake \
build-essential \
gfortran \
mpi-default-bin \
mpi-default-dev \
libsuitesparse-dev \
libsuperlu-dev \
libeigen3-dev \
doxygen \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# add the permission helper script to the my_init service
COPY setpermissions.sh /etc/my_init.d/setpermissions.sh
# create a dumux user
# add the welcome message (copied further down) output to bashrc
# make the set permission helper script executable
# add user to video group which enables graphics if desired
RUN useradd -m --home-dir /dumux dumux \
&& echo "cat /dumux/WELCOME" >> /dumux/.bashrc \
&& chmod +x /etc/my_init.d/setpermissions.sh \
&& usermod -a -G video dumux
# switch to the dumux user and set the working directory
USER dumux
WORKDIR /dumux
# create a shared volume communicating with the host
RUN mkdir /dumux/shared
VOLUME /dumux/shared
# This is the message printed on entry
COPY WELCOME /dumux/WELCOME
# set git user in case installation requires to apply patches
RUN git config --global user.name "Heck2020a"
RUN git config --global user.email "katharina.heck@iws.uni-stuttgart.de"
# Install the dumux module and its dependencies
# This expects the install script to do everything from clone to configure
COPY installHeck2020a.sh /dumux/installHeck2020a.sh
RUN ./installHeck2020a.sh && rm -f /dumux/installHeck2020a.sh
# unset git user
RUN git config --global --unset user.name
RUN git config --global --unset user.email
# switch back to root
WORKDIR /dumux
USER root
# set entry point like advised https://github.com/phusion/baseimage-docker
# this sets the permissions right, see above
ENTRYPOINT ["/sbin/my_init","--quiet","--","/sbin/setuser","dumux","/bin/bash","-l","-c"]
# start interactive shell
CMD ["/bin/bash","-i"]
#!/usr/bin/env bash
# TODO set the image name here to a global address
# after adding your container to your modules container registry
# e.g. git.iws.uni-stuttgart.de:4567/dumux-pub/koch2017a
IMAGE_NAME=git.iws.uni-stuttgart.de:4567/dumux-pub/heck2020a
# the host directory ...
SHARED_DIR_HOST="$(pwd)"
# ... that is mounted into this container directory:
SHARED_DIR_CONTAINER="/dumux/shared"
help ()
{
echo ""
echo "Usage: docker_heck2020a.sh <command> [options]"
echo ""
echo " docker_heck2020a.sh open [image] - run a container from the image."
echo " docker_heck2020a.sh help - display this message."
echo ""
echo "Optionally supply a Docker image name to the open command."
echo ""
}
# start a container. Only argument is the Docker image.
open()
{
IMAGE="$1"
docker run -it \
-e HOST_UID=$(id -u $USER) \
-e HOST_GID=$(id -g $USER) \
-v $SHARED_DIR_HOST:$SHARED_DIR_CONTAINER \
--name dumux_heck2020a \
$IMAGE /bin/bash
}
# Check if user specified valid command otherwise print help message
if [ "$1" == "open" ]; then
IMAGE="$2" : ${IMAGE:="$IMAGE_NAME"}
open $IMAGE
else
help
exit 1
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment