-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
130 lines (112 loc) · 4.49 KB
/
Dockerfile
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
FROM buildpack-deps:focal@sha256:c1557d7311f0f6ec8f47d179a5d93644a2b1b7234c1fbf47757e735909ad8b84
LABEL maintainer "https://github.com/weiji14"
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
# Initiate docker container with user 'jovyan'
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV NB_USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
# Setup conda
ENV CONDA_DIR ${HOME}/.conda
ENV NB_PYTHON_PREFIX ${CONDA_DIR}
ENV MINICONDA_VERSION 4.9.2
RUN cd /tmp && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh && \
echo "122c8c9beb51e124ab32a0fa6426c656 *Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh" | md5sum -c - && \
/bin/bash Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
rm Miniconda3-py38_${MINICONDA_VERSION}-Linux-x86_64.sh && \
$CONDA_DIR/bin/conda config --system --prepend channels conda-forge && \
$CONDA_DIR/bin/conda config --system --set auto_update_conda false && \
$CONDA_DIR/bin/conda config --system --set show_channel_urls true && \
$CONDA_DIR/bin/conda config --system --set pip_interop_enabled true && \
$CONDA_DIR/bin/conda clean --all --quiet --yes && \
$CONDA_DIR/bin/conda init --verbose
# Setup $HOME directory with correct permissions
USER root
RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}
WORKDIR ${HOME}
USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt -qq update && apt install -y --no-install-recommends \
git-svn \
#python3-dev \
#python3-matplotlib \
#python3-minimal \
#python3-numpy \
#python3-pip \
#python3-scipy \
&& rm -rf /var/lib/apt/lists/*
USER $NB_UID
# Use subversion to clone the ISSM svn trunk repository from revision 25855 (11 Dec 2020)
# Get latest revision number and date by running `svn info https://issm.ess.uci.edu/svn/issm`
RUN echo 'anon' | svn checkout --username anon --password-from-stdin -r 25855 https://issm.ess.uci.edu/svn/issm/issm/trunk
# Change to interactive bash shell, so that `conda activate` works
SHELL ["/bin/bash", "-ic"]
RUN conda init --verbose
# Install dependencies in environment.yml file using conda
COPY environment.yml ${HOME}
RUN conda env update -n base -f environment.yml && \
conda clean --all --yes && \
conda list -n base
# Install dependencies shipped with ISSM
ENV ISSM_DIR ${HOME}/trunk
#RUN unset F90 && \
# cd $ISSM_DIR/externalpackages/mpich && \
# ./install-3.0-linux64.sh
#RUN . $ISSM_DIR/etc/environment.sh && \
# cd $ISSM_DIR/externalpackages/petsc && \
# ./install-3.11-linux64.sh
RUN . $ISSM_DIR/etc/environment.sh && \
cd $ISSM_DIR/externalpackages/m1qn3 && \
./install.sh
RUN . $ISSM_DIR/etc/environment.sh && \
cd $ISSM_DIR/externalpackages/triangle && \
./install-linux.sh
# Setup environment variables and configuration settings
RUN cd $ISSM_DIR && \
. $ISSM_DIR/etc/environment.sh && \
autoreconf -ivf
RUN cd $ISSM_DIR && \
./configure \
--prefix="$ISSM_DIR" \
--disable-static \
--enable-debugging \
--enable-development \
--with-numthreads=8 \
--with-python-version=3.7 \
--with-python-dir="$CONDA_DIR" \
--with-python-numpy-dir="$CONDA_DIR/lib/python3.7/site-packages/numpy/core/include/numpy" \
--with-fortran-lib="-L$CONDA_DIR/lib/gcc/x86_64-conda-linux-gnu/7.5.0/ -lgfortran" \
--with-mpi-include="$CONDA_DIR/lib/include" \
--with-mpi-libflags="-L$CONDA_DIR/lib -lmpi -lmpicxx -lmpifort" \
--with-metis-dir="$CONDA_DIR/lib" \
--with-scalapack-dir="$CONDA_DIR/lib" \
--with-mumps-dir="$CONDA_DIR/lib" \
--with-petsc-dir="$CONDA_DIR" \
--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
--with-m1qn3-dir="$ISSM_DIR/externalpackages/m1qn3/install"
# Patch configure file to remove the 'm' for minimal (Python 3.8 and above only)
# RUN sed -i 's/-lpython${PYTHON_VERSION}m/-lpython${PYTHON_VERSION}/g' $ISSM_DIR/configure
# Compile ISSM
RUN cd $ISSM_DIR && \
make --jobs=8 && \
make install
# Make python packages available
ENV PYTHONPATH $ISSM_DIR/bin:$PYTHONPATH
ENV PYTHONPATH $ISSM_DIR/lib:$PYTHONPATH
# Ensure that the ISSM environment is loaded
RUN echo "source $ISSM_DIR/etc/environment.sh" >> $HOME/.bashrc
# Copy remaining files to $HOME
COPY --chown=1000:1000 . ${HOME}
EXPOSE 8888
RUN echo -e '#!/bin/bash -i\nset -e\nconda run "$@"' > .entrypoint.sh && \
chmod +x .entrypoint.sh
ENTRYPOINT ["./.entrypoint.sh"]
CMD ["jupyter", "lab", "--ip", "0.0.0.0"]