forked from lsybarguen/khiva-use-cases
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (29 loc) · 991 Bytes
/
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
FROM shapelets/khiva-python:0.2.0
USER root
# Setting variables to execute jupyter notebooks
ENV NB_USER khiva-binder
ENV NB_UID 1000
ENV VENV_DIR /srv/venv
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
ENV PATH ${VENV_DIR}/bin:$PATH
WORKDIR ${HOME}
COPY . ${HOME}
RUN chown -R ${NB_USER} ${HOME}
RUN apt-get update && \
apt-get -y install python3-venv python3-dev && \
apt-get purge && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create a virtual environment directory owned by a non-privileged user & set up notebook in it
# This allows non-root to install python libraries if required
RUN mkdir -p ${VENV_DIR} && chown -R ${NB_USER} ${VENV_DIR}
USER ${NB_USER}
RUN python3 -m venv ${VENV_DIR}
RUN pip3 install --no-cache-dir tornado==5.*
RUN pip3 install --no-cache-dir notebook==5.* && \
pip3 install --no-cache-dir -r requirements.txt
CMD jupyter notebook --ip 0.0.0.0