FROM registry.yandex.net/platform-base-images/precise-yandex-yt:latest

MAINTAINER Ilya Vorobiev <vorobei@yandex-team.ru>

# Install Tini
ENV TINI_VERSION v0.14.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "-s", "--"]

# Install Jupyter
RUN pip install jupyter
RUN echo "IPython.Cell.options_default.cm_config.lineNumbers = true;" \
    >> /usr/local/lib/python2.7/dist-packages/notebook/static/custom/custom.js
RUN ipython profile create --quiet
ADD ipython_config.py /root/
RUN cat /root/ipython_config.py >> $(ipython profile locate)/ipython_config.py
ADD jupyter.conf /etc/init/jupyter.conf
RUN chmod 644 /etc/init/jupyter.conf
ENV YT_LOG_LEVEL WARNING
EXPOSE 80

# Install and update datascience libs
RUN pip install -U pandas bokeh numexpr

# Add Jupyter extensions
RUN pip install --upgrade pip && \
    pip install pandas pyreadline jupyter_contrib_nbextensions jupyter_nbextensions_configurator yapf ipycache
RUN jupyter contrib nbextension install --user
RUN jupyter nbextension enable code_prettify/code_prettify
RUN jupyter nbextension enable execute_time/ExecuteTime
RUN jupyter nbextension enable codefolding/main
RUN jupyter nbextension enable runtools/main
RUN jupyter nbextension enable select_keymap/main
RUN jupyter nbextension enable snippets_menu/main
RUN jupyter nbextension enable table_beautifier/main
RUN jupyter nbextension enable hinterland/hinterland
RUN jupyter nbextensions_configurator enable --user
