From c34c580f3bef7752ece9956405a1ff1defc4a7ca Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Mon, 27 Mar 2017 13:01:50 -0400 Subject: [PATCH 1/3] Convert Dockerfile to be based on Debian Jessie --- Dockerfile | 116 +++++++++++++++++++++------------------ devops/docker/jupyter.sh | 2 +- 2 files changed, 63 insertions(+), 55 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7b0611c..bfa56584 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,65 +1,73 @@ -FROM base/archlinux:latest - -RUN set -ex \ - && pacman -Sy --noconfirm archlinux-keyring \ - && pacman -Syu --noconfirm \ - && pacman-db-upgrade \ - && pacman -S --noconfirm \ - ca-certificates \ - ca-certificates-utils - -RUN set -ex \ - && pacman -S --noconfirm \ - git \ - openssh \ - npm \ - autoconf \ - automake \ - gcc \ - python2 \ - python2-pip \ - python2-cffi \ - python2-lxml \ - python2-pillow \ - python2-numpy \ - python2-scipy \ - python2-pandas \ - python2-matplotlib \ - python2-seaborn \ - python2-statsmodels \ - python2-scikit-learn \ - cython \ - python2-futures \ - gdal \ - mapnik \ - sed - - -RUN set -ex \ - && pip2 install \ - notebook \ - mapnik \ - pyproj \ - ipywidgets \ - scikit-image +FROM debian:8.7 + +RUN apt-get update -y && apt-get upgrade -y +RUN apt-get install -y gcc g++ make curl + +RUN apt-get install -y libgeos-dev + +RUN curl -O http://download.osgeo.org/gdal/2.1.3/gdal-2.1.3.tar.gz +RUN tar -xzf gdal-2.1.3.tar.gz + +WORKDIR gdal-2.1.3 + +RUN ./configure +RUN make -j$(nproc) +RUN make install +RUN ldconfig + +RUN apt-get install -y git \ + ssh \ + libffi-dev \ + libssl-dev \ + python-pip \ + python-cffi \ + python-lxml \ + python-pil \ + python-numpy \ + python-scipy \ + python-pandas \ + python-matplotlib \ + python-seaborn \ + python-concurrent.futures \ + cython \ + python-scikits-learn \ + python-scikits.statsmodels \ + python-skimage-lib + +# Generates pip2.7 +RUN pip install -U pip + +RUN pip2.7 install -U jupyter notebook \ + mapnik \ + pyproj \ + ipywidgets \ + scikit-image RUN jupyter nbextension enable --py widgetsnbextension --sys-prefix # Generate default config and disable authentication -RUN /usr/sbin/jupyter-notebook --generate-config \ - && sed -i s/#c.NotebookApp.token\ \=\ \'\'/c.NotebookApp.token\ \=\ \'\'/g \ - /root/.jupyter/jupyter_notebook_config.py +RUN jupyter-notebook --generate-config +RUN sed -i "s/#c.NotebookApp.token = ''/c.NotebookApp.token = ''/" /root/.jupyter/jupyter_notebook_config.py + +# Install/setup NVM +RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash \ + && . /root/.bashrc && nvm install v6.10.1 && ln -s /root/.nvm/versions/node/v6.10.1/bin/npm /usr/bin/npm + +RUN pip2.7 install https://github.com/OpenGeoscience/KTile/archive/master.zip -RUN pip2 install https://github.com/OpenGeoscience/KTile/archive/master.zip ADD . /opt/geonotebook -ADD devops/docker/jupyter.sh /jupyter.sh +ADD ./devops/docker/jupyter.sh /jupyter.sh + +WORKDIR /opt/geonotebook -RUN pushd /opt/geonotebook \ - && pip2 install . \ - && jupyter serverextension enable --py geonotebook --sys-prefix \ - && jupyter nbextension enable --py geonotebook --sys-prefix +RUN pip2.7 install -r prerequirements.txt && \ + pip2.7 install -r requirements.txt && \ + pip2.7 install . && \ + jupyter serverextension enable --py geonotebook --sys-prefix && \ + jupyter nbextension enable --py geonotebook --sys-prefix VOLUME /notebooks WORKDIR /notebooks -CMD ../jupyter.sh + +ENTRYPOINT ["/jupyter.sh"] diff --git a/devops/docker/jupyter.sh b/devops/docker/jupyter.sh index 9e138f4d..1aa36e97 100755 --- a/devops/docker/jupyter.sh +++ b/devops/docker/jupyter.sh @@ -1,3 +1,3 @@ #!/bin/bash -/usr/sbin/jupyter-notebook --no-browser --ip='*' +jupyter-notebook --no-browser --ip='0.0.0.0' "$@" From 7b540f5b6b3d12fc92fc6390f22d477bd2664364 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Tue, 28 Mar 2017 10:17:00 -0400 Subject: [PATCH 2/3] Add node_modules to .dockerignore file --- .dockerignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..58997874 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +js/node_modules/ From 0404cbab6faa691c5c8e3ceaae6837174f08d65c Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Wed, 29 Mar 2017 09:51:38 -0400 Subject: [PATCH 3/3] Update Docker documentation to reflect disabled auth token --- devops/docker/README.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/devops/docker/README.md b/devops/docker/README.md index 4f94efb4..fb4e97a0 100644 --- a/devops/docker/README.md +++ b/devops/docker/README.md @@ -25,17 +25,7 @@ This does several things. **Second**, it maps a host system path ```/path/to/your/notebooks``` to the docker containers ```/notebooks``` directory. This ensures that the notebooks you create, edit, and save are available on your host system, and are not *destroyed* when the you exit the container. -**Third** the container is run with an interactive terminal, this is important because the output of the jupyter command will include a link that you must click to start up the notebook. This output will look like the following: - -``` -[C 20:30:42.834 NotebookApp] - - Copy/paste this URL into your browser when you connect for the first time, - to login with a token: - http://localhost:8888/?token=4a4fe605780711fb0aea99b55836142c95af157277ac25d5 - -``` -You will not be able to log in to the notebook server without this link! +**Third**, the notebook starts in an interactive terminal and is accessible through http://localhost:8888. **Finally**, we include the ```--rm``` option to clean up the notebook after you exit the process.