-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
61 lines (48 loc) · 2.19 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
# This file creates a container that runs a jupyter lab server on Raspberry Pi
#
# Author: Jaime Ferrando Huertas
# Date 15/02/2020
#
# Originally from: https://github.com/mkjiang/rpi-jupyter/blob/master/Dockerfile and https://github.com/kidig/rpi-jupyter-lab/blob/master/Dockerfile
#
FROM balenalib/raspberry-pi-python:3.6-20200207
MAINTAINER Jaime Ferrando Huertas <[email protected]>
WORKDIR /root
# Update pip and install jupyter
RUN apt-get update
RUN apt-get install -y libncurses5-dev
RUN apt-get install -y libzmq-dev
RUN apt-get install -y libfreetype6-dev
RUN apt-get install -y libpng-dev
RUN apt-get install -y python-dev --fix-missing
RUN apt-get install -y patch
RUN apt-get install -y build-essential
RUN pip3 install --upgrade pip
RUN pip3 install cython
RUN pip3 install readline ipywidgets jupyter jupyterlab
# Configure jupyter
RUN jupyter nbextension enable --py widgetsnbextension
RUN jupyter serverextension enable --py jupyterlab
RUN jupyter notebook --generate-config
RUN mkdir notebooks
RUN sed -i "/c.NotebookApp.open_browser/c c.NotebookApp.open_browser = False" /root/.jupyter/jupyter_notebook_config.py \
&& sed -i "/c.NotebookApp.ip/c c.NotebookApp.ip = '*'" /root/.jupyter/jupyter_notebook_config.py \
&& sed -i "/c.NotebookApp.notebook_dir/c c.NotebookApp.notebook_dir = '/root'" /root/.jupyter/jupyter_notebook_config.py \
&& sed -i "/c.NotebookApp.password/c c.NotebookApp.password = 'sha1:5815fb7ca805:f09ed218dfcc908acb3e29c3b697079fea37486a'" /root/.jupyter/jupyter_notebook_config.py
VOLUME /root/notebooks
# Add Tini. Tini operates as a process subreaper for jupyter. This prevents kernel crashes.
ENV TINI_VERSION 0.18.0
ENV CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
ADD https://github.com/krallin/tini/archive/v${TINI_VERSION}.tar.gz /root/v${TINI_VERSION}.tar.gz
RUN apt-get install -y cmake
RUN tar zxvf v${TINI_VERSION}.tar.gz \
&& cd tini-${TINI_VERSION} \
&& cmake . \
&& make \
&& cp tini /usr/bin/. \
&& cd .. \
&& rm -rf "./tini-${TINI_VERSION}" \
&& rm "./v${TINI_VERSION}.tar.gz"
ENTRYPOINT ["/usr/bin/tini", "--"]
EXPOSE 8888
CMD ["jupyter", "lab", "--allow-root"]