-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathDockerfile
More file actions
83 lines (76 loc) · 2.73 KB
/
Copy pathDockerfile
File metadata and controls
83 lines (76 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM ubuntu:20.04 as base_runtime
LABEL maintainer="https://github.com/underworldcode/"
ENV LANG=C.UTF-8
ENV PYVER=3.8
# Setup some things in anticipation of virtualenvs
ENV VIRTUAL_ENV=/opt/venv
# The following ensures that the venv takes precedence if available
ENV PATH=${VIRTUAL_ENV}/bin:$PATH
# The following ensures venv packages are available when using system python (such as from jupyter)
ENV PYTHONPATH=${PYTHONPATH}:${VIRTUAL_ENV}/lib/python${PYVER}/site-packages
# add joyvan user, volume mount and expose port 8888
EXPOSE 8888
ENV NB_USER jovyan
ENV NB_WORK /home/$NB_USER
RUN useradd -m -s /bin/bash -N $NB_USER -g users \
&& mkdir -p /$NB_WORK/workspace \
&& chown -R $NB_USER:users $NB_WORK
VOLUME $NB_WORK/workspace
# make virtualenv directory and set permissions
RUN mkdir ${VIRTUAL_ENV} \
&& chmod ugo+rwx ${VIRTUAL_ENV}
# install runtime requirements
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
bash-completion \
bash-completion \
python${PYVER}-minimal \
python3-virtualenv \
python3-pip \
python3-numpy \
python3-numpy-dbg \
vim \
less \
git \
valgrind valgrind-dbg valgrind-mpi \
gdb cgdb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install -U setuptools \
&& pip3 install --no-cache-dir \
packaging \
appdirs \
jupyter \
jupytext \
jupyterlab \
plotly \
matplotlib \
pillow \
ipython \
ipyparallel \
pint==0.9 \
scipy \
rise \
tabulate
# Lets grab lavavu & requirements
COPY --from=underworldcode/base:lavavu /opt /opt
COPY --from=underworldcode/base:lavavu /usr/local /usr/local
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends $(awk '{print $1'} /opt/installed.txt) \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN PYTHONPATH= /usr/bin/pip3 install -r /opt/requirements.txt
# mpi, petsc, mpi4py, petsc4py, h5py
COPY --from=underworldcode/base:petsc /opt /opt
COPY --from=underworldcode/base:petsc /usr/local /usr/local
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends $(awk '{print $1'} /opt/installed.txt) \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN PYTHONPATH= /usr/bin/pip3 install -r /opt/requirements.txt
# jovyan user, finalise jupyter env
USER $NB_USER
# RUN ipython profile create --parallel --profile=mpi \
# && echo "c.IPClusterEngines.engine_launcher_class = 'MPIEngineSetLauncher'" >> $NB_WORK/.ipython/profile_mpi/ipcluster_config.py
WORKDIR $NB_WORK
CMD ["jupyter", "notebook", "--no-browser", "--ip='0.0.0.0'"]