From 98fe5573750b0f463958d55eca8a019f959fabf0 Mon Sep 17 00:00:00 2001 From: Sachin Shah Date: Sat, 9 Mar 2019 12:18:40 -0600 Subject: [PATCH] Jupyter extensions in Docker image Adds Jupyter extension to Docker image for fsprojects/IfSharp#199 --- Dockerfile | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index edba846..f760343 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,38 @@ FROM mono:5.18.0.225 +# Install Anaconda (conda / miniconda) +RUN apt update \ + && apt install -y \ + apt-transport-https \ + wget +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/Miniconda3-latest-Linux-x86_64.sh +RUN chmod u+x ~/Miniconda3-latest-Linux-x86_64.sh +RUN ~/Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda +RUN . /opt/miniconda/bin/activate +ENV PATH="/opt/miniconda/bin:$PATH" + +# Test conda to ensure the above worked. +RUN conda -V + +# Install other dependencies RUN apt update \ && apt install -y \ python3-pip \ git -RUN python3 -m pip install --upgrade setuptools pip && python3 -m pip install jupyter +# Install Jupyter and extensions +RUN conda update -n base -c defaults conda +RUN conda install -c anaconda jupyter +RUN conda install -c conda-forge jupyter_contrib_nbextensions +RUN conda install -c conda-forge jupyter_nbextensions_configurator +# Install IfSharp WORKDIR / RUN git clone https://github.com/fsprojects/IfSharp.git RUN mkdir notebooks VOLUME notebooks +# Add user RUN useradd -ms /bin/bash ifsharp-user RUN chown -R ifsharp-user /notebooks && chown -R ifsharp-user /IfSharp USER ifsharp-user @@ -20,12 +41,17 @@ WORKDIR /IfSharp RUN ./build.sh RUN mono bin/ifsharp.exe --install +# Install extensions and configurator +RUN jupyter contrib nbextension install --user +RUN jupyter nbextensions_configurator enable --user + EXPOSE 8888 +# Final entrypoint ENTRYPOINT ["jupyter", \ "notebook", \ "--no-browser", \ - "--ip='*'", \ + "--ip='0.0.0.0'", \ "--port=8888", \ "--notebook-dir=/notebooks" \ ]