notebook/Dockerfile

114 lines
3.3 KiB
Docker
Raw Normal View History

# Installs Jupyter Notebook and IPython kernel from the current branch
# Another Docker container should inherit with `FROM jupyter/notebook`
# to run actual services.
2014-09-13 01:38:36 +08:00
FROM ubuntu:14.04
2014-09-13 00:46:41 +08:00
MAINTAINER Project Jupyter <jupyter@googlegroups.com>
2014-09-13 00:46:41 +08:00
# Not essential, but wise to set the lang
# Note: Users with other languages should set this in their derivative image
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV PYTHONIOENCODING UTF-8
2015-10-11 04:12:13 +08:00
# Remove preinstalled copy of python that blocks our ability to install development python.
RUN DEBIAN_FRONTEND=noninteractive apt-get remove -yq \
python3-minimal \
python3.4 \
python3.4-minimal \
libpython3-stdlib \
libpython3.4-stdlib \
libpython3.4-minimal
# Python binary and source dependencies
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
2015-10-02 07:12:50 +08:00
build-essential \
ca-certificates \
curl \
git \
language-pack-en \
libcurl4-openssl-dev \
libffi-dev \
2015-10-02 07:12:50 +08:00
libsqlite3-dev \
libzmq3-dev \
pandoc \
python \
python3 \
2015-10-02 07:12:50 +08:00
python-dev \
python3-dev \
sqlite3 \
texlive-fonts-recommended \
texlive-latex-base \
texlive-latex-extra \
zlib1g-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Tini
RUN curl -L https://github.com/krallin/tini/releases/download/v0.6.0/tini > tini && \
echo "d5ed732199c36a1189320e6c4859f0169e950692f451c03e7854243b95f4234b *tini" | sha256sum -c - && \
mv tini /usr/local/bin/tini && \
chmod +x /usr/local/bin/tini
# Install the recent pip release
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python2 get-pip.py && \
python3 get-pip.py && \
rm get-pip.py && \
pip2 --no-cache-dir install requests[security] && \
pip3 --no-cache-dir install requests[security] && \
rm get-pip.py && \
rm -rf /root/.cache
# Install some dependencies.
RUN pip2 --no-cache-dir install ipykernel && \
pip3 --no-cache-dir install ipykernel && \
\
python2 -m ipykernel.kernelspec && \
python3 -m ipykernel.kernelspec && \
rm -rf /root/.cache
# Move notebook contents into place.
ADD . /usr/src/jupyter-notebook
# Install dependencies and run tests.
RUN BUILD_DEPS="nodejs-legacy npm" && \
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq $BUILD_DEPS && \
\
pip3 install --no-cache-dir --pre -e /usr/src/jupyter-notebook && \
\
2015-10-11 05:17:41 +08:00
npm cache clean && \
apt-get clean && \
rm -rf /root/.npm && \
rm -rf /root/.cache && \
rm -rf /root/.config && \
rm -rf /root/.local && \
rm -rf /root/tmp && \
rm -rf /var/lib/apt/lists/* && \
apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $BUILD_DEPS
# Run tests.
RUN pip3 install --no-cache-dir notebook[test] && \
\
nosetests notebook && \
\
pip3 uninstall -y nose requests && \
rm -rf /root/.cache
2015-10-02 05:24:18 +08:00
# Add a notebook profile.
RUN mkdir -p -m 700 /root/.jupyter/ && \
echo "c.NotebookApp.ip = '*'" >> /root/.jupyter/jupyter_notebook_config.py
VOLUME /notebooks
WORKDIR /notebooks
2015-10-02 05:24:18 +08:00
EXPOSE 8888
ENTRYPOINT ["tini", "--"]
CMD ["jupyter", "notebook"]