Dockerfile 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. FROM resin/rpi-raspbian:jessie-20170531
  2. # Set the variables
  3. ENV DEBIAN_FRONTEND noninteractive
  4. WORKDIR /root
  5. # Install packages necessary for compiling python
  6. RUN apt-get update && apt-get install -y \
  7. build-essential \
  8. libncursesw5-dev \
  9. libgdbm-dev \
  10. libc6-dev \
  11. zlib1g-dev \
  12. libsqlite3-dev \
  13. tk-dev \
  14. libssl-dev \
  15. openssl \
  16. curl \
  17. vim \
  18. git \
  19. mc \
  20. python \
  21. python-dev \
  22. python-pip \
  23. libncurses5-dev
  24. RUN sudo echo "Europe/Berlin" > /etc/timezone
  25. RUN sudo dpkg-reconfigure -f noninteractive tzdata
  26. # Update pip and install jupyter
  27. RUN pip install --upgrade pip
  28. RUN pip install readline notebook==5.1.0
  29. # Configure jupyter
  30. # we run this manually after mounting /root/.jupyter
  31. # RUN jupyter notebook --generate-config
  32. # RUN mkdir notebooks
  33. # RUN sed -i "/c.NotebookApp.open_browser/c c.NotebookApp.open_browser = False" /root/.jupyter/jupyter_notebook_config.py \
  34. # && sed -i "/c.NotebookApp.ip/c c.NotebookApp.ip = '*'" /root/.jupyter/jupyter_notebook_config.py \
  35. # && sed -i "/c.NotebookApp.notebook_dir/c c.NotebookApp.notebook_dir = '/root/notebooks'" /root/.jupyter/jupyter_notebook_config.py
  36. # change to letscode.00
  37. # sudo vi /opt/fast/jupyter/config_root/jupyter_notebook_config.py
  38. VOLUME /root/notebooks
  39. # Add Tini. Tini operates as a process subreaper for jupyter. This prevents kernel crashes.
  40. ENV TINI_VERSION 0.14.0
  41. ENV CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
  42. ADD https://github.com/krallin/tini/archive/v${TINI_VERSION}.tar.gz /root/v${TINI_VERSION}.tar.gz
  43. RUN apt-get install -y cmake
  44. RUN tar zxvf v${TINI_VERSION}.tar.gz \
  45. && cd tini-${TINI_VERSION} \
  46. && cmake . \
  47. && make \
  48. && cp tini /usr/bin/. \
  49. && cd .. \
  50. && rm -rf "./tini-${TINI_VERSION}" \
  51. && rm "./v${TINI_VERSION}.tar.gz"
  52. ENTRYPOINT ["/usr/bin/tini", "--"]
  53. EXPOSE 8888
  54. CMD ["jupyter", "notebook", "--allow-root"]
  55. HEALTHCHECK --interval=10s CMD curl -sS --fail http://localhost:8888 || exit 1
  56. # python-pip
  57. # install ipython2 kernel into jupyter
  58. # RUN pip install --upgrade pip
  59. # RUN python2 -m pip install ipykernel
  60. # RUN python2 -m ipykernel install --user
  61. # this version will be used by matrix python bindings
  62. RUN pyversions -d
  63. RUN git clone https://github.com/hzeller/rpi-rgb-led-matrix.git /matrix
  64. WORKDIR /matrix
  65. RUN sed -i "s/=regular/=adafruit-hat/g" lib/Makefile
  66. # RUN apt-get install -y
  67. # for C++-demos
  68. RUN make -C examples-api-use
  69. # for python interface
  70. RUN cd bindings/python && make build-python install-python
  71. RUN apt-get -y install python-pillow
  72. RUN pip install ipywidgets path.py requests
  73. RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension