Advertisement
ROODAY

Jupyter Notebook Debug Dockerfile

Apr 7th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.57 KB | None | 0 0
  1. # Installs Jupyter Notebook and IPython kernel from the current branch
  2. # Another Docker container should inherit with `FROM jupyter/notebook`
  3. # to run actual services.
  4. #
  5. # For opinionated stacks of ready-to-run Jupyter applications in Docker,
  6. # check out docker-stacks <https://github.com/jupyter/docker-stacks>
  7.  
  8. FROM jupyter/ubuntu_14_04_locale_fix
  9.  
  10. MAINTAINER Project Jupyter <jupyter@googlegroups.com>
  11.  
  12. # Not essential, but wise to set the lang
  13. # Note: Users with other languages should set this in their derivative image
  14. ENV LANGUAGE en_US.UTF-8
  15. ENV LANG en_US.UTF-8
  16. ENV LC_ALL en_US.UTF-8
  17. ENV PYTHONIOENCODING UTF-8
  18.  
  19. # Remove preinstalled copy of python that blocks our ability to install development python.
  20. RUN DEBIAN_FRONTEND=noninteractive apt-get remove -yq \
  21.         python3-minimal \
  22.         python3.4 \
  23.         python3.4-minimal \
  24.         libpython3-stdlib \
  25.         libpython3.4-stdlib \
  26.         libpython3.4-minimal
  27.  
  28. # Python binary and source dependencies
  29. RUN apt-get update -qq && \
  30.     DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
  31.         build-essential \
  32.         ca-certificates \
  33.         curl \
  34.         git \
  35.         language-pack-en \
  36.         libcurl4-openssl-dev \
  37.         libffi-dev \
  38.         libsqlite3-dev \
  39.         libzmq3-dev \
  40.         pandoc \
  41.         python \
  42.         python3 \
  43.         python-dev \
  44.         python3-dev \
  45.         sqlite3 \
  46.         texlive-fonts-recommended \
  47.         texlive-latex-base \
  48.         texlive-latex-extra \
  49.         zlib1g-dev && \
  50.     apt-get clean && \
  51.     rm -rf /var/lib/apt/lists/*
  52.  
  53. # Install Tini
  54. RUN curl -L https://github.com/krallin/tini/releases/download/v0.6.0/tini > tini && \
  55.     echo "d5ed732199c36a1189320e6c4859f0169e950692f451c03e7854243b95f4234b *tini" | sha256sum -c - && \
  56.     mv tini /usr/local/bin/tini && \
  57.     chmod +x /usr/local/bin/tini
  58.  
  59. # Install the recent pip release
  60. RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
  61.     python2 get-pip.py && \
  62.     python3 get-pip.py && \
  63.     rm get-pip.py && \
  64.     pip2 --no-cache-dir install requests[security] && \
  65.     pip3 --no-cache-dir install requests[security] && \
  66.     rm -rf /root/.cache
  67.  
  68. # Install some dependencies.
  69. RUN pip2 --no-cache-dir install ipykernel && \
  70.     pip3 --no-cache-dir install ipykernel && \
  71.     \
  72.     python2 -m ipykernel.kernelspec && \
  73.     python3 -m ipykernel.kernelspec && \
  74.     rm -rf /root/.cache
  75.  
  76. # Move notebook contents into place.
  77. ADD . /usr/src/jupyter-notebook
  78.  
  79. # Install dependencies and run tests.
  80. RUN BUILD_DEPS="nodejs-legacy npm" && \
  81.     apt-get update -qq && \
  82.     DEBIAN_FRONTEND=noninteractive apt-get install -yq $BUILD_DEPS && \
  83.     \
  84.     pip3 install --no-cache-dir /usr/src/jupyter-notebook && \
  85.     pip2 install --no-cache-dir widgetsnbextension && \
  86.     pip3 install --no-cache-dir widgetsnbextension && \
  87.     \
  88.     npm cache clean && \
  89.     apt-get clean && \
  90.     rm -rf /root/.npm && \
  91.     rm -rf /root/.cache && \
  92.     rm -rf /root/.config && \
  93.     rm -rf /root/.local && \
  94.     rm -rf /root/tmp && \
  95.     rm -rf /var/lib/apt/lists/* && \
  96.     apt-get purge -y --auto-remove \
  97.         -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $BUILD_DEPS
  98.  
  99. # Run tests.
  100. RUN pip3 install --no-cache-dir notebook[test] && nosetests -v notebook
  101.  
  102. # Add a notebook profile.
  103. RUN mkdir -p -m 700 /root/.jupyter/ && \
  104.     echo "c.NotebookApp.ip = '*'" >> /root/.jupyter/jupyter_notebook_config.py
  105.  
  106. VOLUME /notebooks
  107. WORKDIR /notebooks
  108.  
  109. EXPOSE 8888
  110.  
  111. ENTRYPOINT ["tini", "--"]
  112. CMD ["jupyter", "notebook", "--debug"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement