Last active
October 16, 2018 22:29
-
-
Save mereldawu/d6069771335530d255937083611636f5 to your computer and use it in GitHub Desktop.
scraper dockerfile with jupyter pre- and post-save hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM jupyter/scipy-notebook:latest | |
MAINTAINER MERELDA WU | |
USER root | |
RUN apt-get update && apt-get install -y vim | |
RUN pip install --upgrade pip notebook | |
RUN conda install -c conda-forge -y jupyter_contrib_nbextensions | |
RUN jupyter contrib nbextension install --user && \ | |
jupyter nbextensions_configurator enable --user | |
RUN pip install googlemaps mysql-connector-python urllib3 xmltodict bs4 python-dotenv pylint | |
RUN jupyter nbextension enable init_cell/main | |
RUN jupyter nbextension enable highlighter/highlighter | |
RUN jupyter nbextension enable rubberband/main | |
RUN jupyter nbextension enable snippets/main | |
RUN jupyter nbextension enable toc2/main | |
RUN jupyter nbextension enable varInspector/main | |
RUN echo "\n\ | |
import os\n\ | |
from subprocess import check_call\n\ | |
\n\ | |
c = get_config()\n\ | |
\n\ | |
def post_save(model, os_path, contents_manager):\n\ | |
if model['type'] != 'notebook':\n\ | |
return # only do this for notebooks\n\ | |
d, fname = os.path.split(os_path)\n\ | |
check_call(['ipython', 'nbconvert', '--to', 'script', fname], cwd=d)\n\ | |
\n\ | |
c.FileContentsManager.post_save_hook = post_save" >> /home/jovyan/.jupyter/jupyter_notebook_config.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment