-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
24 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM continuumio/miniconda3 | ||
|
||
# Install build essentials and clean up | ||
RUN apt-get update --quiet \ | ||
&& apt-get install -y --no-install-recommends --quiet build-essential \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Update conda, install packages, and clean up | ||
RUN conda update conda --yes --quiet \ | ||
&& conda install python=3.5 pip numpy scipy pandas --yes --quiet \ | ||
&& conda clean --yes --all \ | ||
&& hash -r | ||
|
||
# Get the requirements files (seperate from the main body) | ||
COPY requirements.txt requirements_dev.txt /reqs/ | ||
|
||
# Install requirements and clean up | ||
RUN pip --no-cache-dir install -r /reqs/requirements.txt \ | ||
&& pip --no-cache-dir install -r /reqs/requirements_dev.txt \ | ||
&& pip install jupyter jupyterlab \ | ||
&& rm -rf /root/.cache \ | ||
&& rm -rf /reqs | ||
|
||
# Manually install GPflow and clean up | ||
RUN git clone --depth=1 --branch=0.4.0 https://github.com/GPflow/GPflow.git \ | ||
&& cd GPflow \ | ||
&& python setup.py install \ | ||
&& rm -rf /GPflow | ||
|
||
# Output scrubber for jupyter | ||
ADD scripts/jupyter_output.py / | ||
|
||
RUN jupyter notebook --generate-config \ | ||
&& cat /jupyter_output.py >> /root/.jupyter/jupyter_notebook_config.py \ | ||
&& rm /jupyter_output.py | ||
|
||
WORKDIR /code | ||
|
||
CMD python setup.py develop \ | ||
&& jupyter lab --ip="0.0.0.0" --no-browser --allow-root |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def scrub_output_pre_save(model, **kwargs): | ||
"""scrub output before saving notebooks""" | ||
# only run on notebooks | ||
if model['type'] != 'notebook': | ||
return | ||
# only run on nbformat v4 | ||
if model['content']['nbformat'] != 4: | ||
return | ||
|
||
for cell in model['content']['cells']: | ||
if cell['cell_type'] != 'code': | ||
continue | ||
cell['outputs'] = [] | ||
cell['execution_count'] = None | ||
|
||
c.FileContentsManager.pre_save_hook = scrub_output_pre_save |