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

Docker-related files added

parent 123843a4
# Heck2020a docker container
# see for information on the base image
# It is Ubuntu LTS customized for better Docker compatibility
FROM phusion/baseimage:focal-1.1.0
# run Ubuntu update as advised on
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 /etc/my_init.d/
# 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/ \
&& 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
# set git user in case installation requires to apply patches
RUN git config --global "Heck2020a"
RUN git config --global ""
# Install the dumux module and its dependencies
# This expects the install script to do everything from clone to configure
COPY /dumux/
RUN ./ && rm -f /dumux/
# unset git user
RUN git config --global --unset
RUN git config --global --unset
# switch back to root
WORKDIR /dumux
USER root
# set entry point like advised
# 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.
# the host directory ...
# ... that is mounted into this container directory:
help ()
echo ""
echo "Usage: <command> [options]"
echo ""
echo " open [image] - run a container from the image."
echo " 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.
docker run -it \
-e HOST_UID=$(id -u $USER) \
-e HOST_GID=$(id -g $USER) \
--name dumux_heck2020a \
$IMAGE /bin/bash
# Check if user specified valid command otherwise print help message
if [ "$1" == "open" ]; then
open $IMAGE
exit 1
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