Dockerfile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. python-pillow
  25. RUN sudo echo "Europe/Berlin" > /etc/timezone
  26. RUN sudo dpkg-reconfigure -f noninteractive tzdata
  27. # Update pip and install jupyter
  28. RUN pip install --upgrade pip
  29. RUN pip install readline notebook==5.2.0 ipywidgets path.py requests cython
  30. RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension
  31. # Configure jupyter
  32. # we run this manually after mounting /root/.jupyter
  33. # RUN jupyter notebook --generate-config
  34. # RUN mkdir notebooks
  35. # RUN sed -i "/c.NotebookApp.open_browser/c c.NotebookApp.open_browser = False" /root/.jupyter/jupyter_notebook_config.py \
  36. # && sed -i "/c.NotebookApp.ip/c c.NotebookApp.ip = '*'" /root/.jupyter/jupyter_notebook_config.py \
  37. # && sed -i "/c.NotebookApp.notebook_dir/c c.NotebookApp.notebook_dir = '/root/notebooks'" /root/.jupyter/jupyter_notebook_config.py
  38. # change to letscode.00
  39. # sudo vi /opt/fast/jupyter/config_root/jupyter_notebook_config.py
  40. VOLUME /root/notebooks
  41. # Add Tini. Tini operates as a process subreaper for jupyter. This prevents kernel crashes.
  42. ENV TINI_VERSION 0.14.0
  43. ENV CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
  44. ADD https://github.com/krallin/tini/archive/v${TINI_VERSION}.tar.gz /root/v${TINI_VERSION}.tar.gz
  45. RUN apt-get install -y cmake
  46. RUN tar zxvf v${TINI_VERSION}.tar.gz \
  47. && cd tini-${TINI_VERSION} \
  48. && cmake . \
  49. && make \
  50. && cp tini /usr/bin/. \
  51. && cd .. \
  52. && rm -rf "./tini-${TINI_VERSION}" \
  53. && rm "./v${TINI_VERSION}.tar.gz"
  54. ENTRYPOINT ["/usr/bin/tini", "--"]
  55. EXPOSE 8888
  56. CMD ["jupyter", "notebook", "--allow-root"]
  57. HEALTHCHECK --interval=10s CMD curl -sS --fail http://localhost:8888 || exit 1
  58. # python-pip
  59. # install ipython2 kernel into jupyter
  60. # RUN pip install --upgrade pip
  61. # RUN python2 -m pip install ipykernel
  62. # RUN python2 -m ipykernel install --user
  63. # this version will be used by matrix python bindings
  64. RUN pyversions -d
  65. RUN git clone https://github.com/hzeller/rpi-rgb-led-matrix.git /matrix
  66. WORKDIR /matrix
  67. RUN sed -i "s/=regular/=adafruit-hat-pwm/g" lib/Makefile
  68. # RUN apt-get install -y
  69. # for C++-demos
  70. RUN make -C examples-api-use
  71. # for python interface
  72. RUN cd bindings/python && make build-python install-python