# This file creates a container that runs a jupyter lab server on Raspberry Pi # 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.8-build 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 RUN pip3 install numpy # needs to build orjson - does not work on armv7 #~ RUN pip3 install ipycanvas #~ RUN jupyter labextension install ipycanvas # 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 # passwd is "code" CMD ["jupyter", "lab", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password='argon2:$argon2id$v=19$m=10240,t=10,p=8$GXZHXm2yFviNanoy9hyULw$1YLbN5ymQxuwvwPVN5e0hA'"]