From 9cdda101c722a81c995f33cab98ad3edd6daeda7 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 18 Apr 2016 14:38:39 +0200 Subject: [PATCH 1/7] Move onbuild step to jupyterhub-onbuild Removes onbuild from from jupyter/jupyterhub image, though it remains incomplete and will not run without a config file. --- Dockerfile | 17 +++++++---------- Dockerfile.onbuild | 11 +++++++++++ circle.yml | 1 + examples/postgres/hub/Dockerfile | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 Dockerfile.onbuild diff --git a/Dockerfile b/Dockerfile index 80f29079..8d69eeb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,16 @@ -# A base docker image that includes juptyerhub and IPython master +# An incomplete base docker image for running JupyterHub # # Build your own derivative images starting with # # FROM jupyter/jupyterhub:latest # +# And put your jupyterhub_config.py in /srv/jupyterhub/jupyterhub_config.py. +# +# If you base on jupyter/jupyterhub-onbuild +# your jupyterhub_config.py will be added automatically +# from your docker directory. FROM debian:jessie - MAINTAINER Jupyter Project # install nodejs, utf8 locale @@ -32,21 +36,14 @@ ENV PATH=/opt/conda/bin:$PATH # install js dependencies RUN npm install -g configurable-http-proxy && rm -rf ~/.npm -WORKDIR /srv/ ADD . /srv/jupyterhub WORKDIR /srv/jupyterhub/ RUN python setup.py js && pip install . && \ rm -rf node_modules ~/.cache ~/.npm -WORKDIR /srv/jupyterhub/ - -# Derivative containers should add jupyterhub config, -# which will be used when starting the application. - EXPOSE 8000 LABEL org.jupyter.service="jupyterhub" -ONBUILD ADD jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py -CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"] +CMD ["jupyterhub"] diff --git a/Dockerfile.onbuild b/Dockerfile.onbuild new file mode 100644 index 00000000..c9e75e66 --- /dev/null +++ b/Dockerfile.onbuild @@ -0,0 +1,11 @@ +# JupyterHub Dockerfile that loads your jupyterhub_config.py +# +# Adds ONBUILD step to jupyter/jupyterhub to load your juptyerhub_config.py into the image +# +# Derivative images must have jupyterhub_config.py next to the Dockerfile. + +FROM jupyter/jupyterhub + +ONBUILD ADD jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py + +CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"] diff --git a/circle.yml b/circle.yml index 0a3a1227..55ea2b3a 100644 --- a/circle.yml +++ b/circle.yml @@ -9,3 +9,4 @@ dependencies: test: override: - docker build -t jupyter/jupyterhub . + - docker build -t jupyter/jupyterhub-onbuild -f Dockerfile.onbuild . diff --git a/examples/postgres/hub/Dockerfile b/examples/postgres/hub/Dockerfile index 1e6602fa..a1665a43 100644 --- a/examples/postgres/hub/Dockerfile +++ b/examples/postgres/hub/Dockerfile @@ -1,4 +1,4 @@ -FROM jupyter/jupyterhub +FROM jupyter/jupyterhub-onbuild MAINTAINER Jupyter Project From 8b61eb7347ce359bdcd88885ff1fdd0dfc6447d1 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 18 Apr 2016 15:38:50 +0200 Subject: [PATCH 2/7] install from miniconda 4.0.5 - checksum miniconda installer - move jupyterhub src to /src/jupyterhub --- Dockerfile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8d69eeb8..f99828c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,10 @@ # # And put your jupyterhub_config.py in /srv/jupyterhub/jupyterhub_config.py. # +# Or you can create your jupyterhub config and database on the host machine, and mount it with: +# +# docker run -v $PWD:/srv/jupyterhub -t jupyter/jupyterhub +# # If you base on jupyter/jupyterhub-onbuild # your jupyterhub_config.py will be added automatically # from your docker directory. @@ -26,7 +30,8 @@ RUN apt-get -y update && \ ENV LANG C.UTF-8 # install Python with conda -RUN wget -q https://repo.continuum.io/miniconda/Miniconda3-3.9.1-Linux-x86_64.sh -O /tmp/miniconda.sh && \ +RUN wget -q https://repo.continuum.io/miniconda/Miniconda3-4.0.5-Linux-x86_64.sh -O /tmp/miniconda.sh && \ + echo 'a7bcd0425d8b6688753946b59681572f63c2241aed77bf0ec6de4c5edc5ceeac */tmp/miniconda.sh' | shasum -a 256 -c - && \ bash /tmp/miniconda.sh -f -b -p /opt/conda && \ /opt/conda/bin/conda install --yes python=3.5 sqlalchemy tornado jinja2 traitlets requests pip && \ /opt/conda/bin/pip install --upgrade pip && \ @@ -36,12 +41,14 @@ ENV PATH=/opt/conda/bin:$PATH # install js dependencies RUN npm install -g configurable-http-proxy && rm -rf ~/.npm -ADD . /srv/jupyterhub -WORKDIR /srv/jupyterhub/ +ADD . /src/jupyterhub +WORKDIR /src/jupyterhub RUN python setup.py js && pip install . && \ - rm -rf node_modules ~/.cache ~/.npm + rm -rf $PWD ~/.cache ~/.npm +RUN mkdir -p /srv/jupyterhub/ +WORKDIR /srv/jupyterhub/ EXPOSE 8000 LABEL org.jupyter.service="jupyterhub" From 9fed0334c8284114967662d3da827eb0c23167cb Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 20 Apr 2016 14:43:16 +0200 Subject: [PATCH 3/7] jupyterhub path in dockerfiles --- Dockerfile | 6 +++--- Dockerfile.onbuild | 2 +- circle.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f99828c4..f002e1f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,15 @@ # # Build your own derivative images starting with # -# FROM jupyter/jupyterhub:latest +# FROM jupyterhub/jupyterhub:latest # # And put your jupyterhub_config.py in /srv/jupyterhub/jupyterhub_config.py. # # Or you can create your jupyterhub config and database on the host machine, and mount it with: # -# docker run -v $PWD:/srv/jupyterhub -t jupyter/jupyterhub +# docker run -v $PWD:/srv/jupyterhub -t jupyterhub/jupyterhub # -# If you base on jupyter/jupyterhub-onbuild +# If you base on jupyterhub/jupyterhub-onbuild # your jupyterhub_config.py will be added automatically # from your docker directory. diff --git a/Dockerfile.onbuild b/Dockerfile.onbuild index c9e75e66..f09febf0 100644 --- a/Dockerfile.onbuild +++ b/Dockerfile.onbuild @@ -4,7 +4,7 @@ # # Derivative images must have jupyterhub_config.py next to the Dockerfile. -FROM jupyter/jupyterhub +FROM jupyterhub/jupyterhub ONBUILD ADD jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py diff --git a/circle.yml b/circle.yml index 55ea2b3a..d1721040 100644 --- a/circle.yml +++ b/circle.yml @@ -8,5 +8,5 @@ dependencies: test: override: - - docker build -t jupyter/jupyterhub . - - docker build -t jupyter/jupyterhub-onbuild -f Dockerfile.onbuild . + - docker build -t jupyterhub/jupyterhub . + - docker build -t jupyterhub/jupyterhub-onbuild -f Dockerfile.onbuild . From 8666f3a46c2977dc04c8091d1308ec3520695da4 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 21 Apr 2016 12:43:23 +0200 Subject: [PATCH 4/7] push onbuild image to docker hub with circle-ci --- circle.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index d1721040..8b608992 100644 --- a/circle.yml +++ b/circle.yml @@ -9,4 +9,11 @@ dependencies: test: override: - docker build -t jupyterhub/jupyterhub . - - docker build -t jupyterhub/jupyterhub-onbuild -f Dockerfile.onbuild . + - docker build -t jupyterhub/jupyterhub-onbuild:${CIRCLE_TAG:-latest} -f Dockerfile.onbuild . + +deployment: + hub: + branch: master + commands: + - docker login -u $DOCKER_USER -p $DOCKER_PASS + - docker push jupyterhub/jupyterhub-onbuild:${CIRCLE_TAG:-latest} From f0504420a9b02bb7ae7d45df398ad5183e82631b Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 21 Apr 2016 13:50:27 +0200 Subject: [PATCH 5/7] move docker onbuild to directory --- circle.yml | 2 +- Dockerfile.onbuild => onbuild/Dockerfile | 0 onbuild/README.md | 10 ++++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) rename Dockerfile.onbuild => onbuild/Dockerfile (100%) create mode 100644 onbuild/README.md diff --git a/circle.yml b/circle.yml index 8b608992..162fd16e 100644 --- a/circle.yml +++ b/circle.yml @@ -9,7 +9,7 @@ dependencies: test: override: - docker build -t jupyterhub/jupyterhub . - - docker build -t jupyterhub/jupyterhub-onbuild:${CIRCLE_TAG:-latest} -f Dockerfile.onbuild . + - docker build -t jupyterhub/jupyterhub-onbuild:${CIRCLE_TAG:-latest} onbuild deployment: hub: diff --git a/Dockerfile.onbuild b/onbuild/Dockerfile similarity index 100% rename from Dockerfile.onbuild rename to onbuild/Dockerfile diff --git a/onbuild/README.md b/onbuild/README.md new file mode 100644 index 00000000..8964110d --- /dev/null +++ b/onbuild/README.md @@ -0,0 +1,10 @@ +# JupyterHub onbuild image + +If you base a Dockerfile on this image: + + FROM juptyerhub/jupyterhub-onbuild:0.6 + ... + +then your `jupyterhub_config.py` adjacent to your Dockerfile will be loaded into the image and used by JupyterHub. + +This is how the `jupyter/jupyterhub` docker image behaved prior to 0.6. From fa34ce64b71ed8de3001de48b9f0a341733a384d Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 21 Apr 2016 13:50:35 +0200 Subject: [PATCH 6/7] include dockerfiles in manifest --- MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 44e4a349..1e85e05b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,7 +4,9 @@ include setupegg.py include bower.json include package.json include *requirements.txt +include Dockerfile +graft onbuild graft jupyterhub graft scripts graft share From 35c261d0ed92af97047dc0ae5cf1dd4971d4f9f7 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 21 Apr 2016 21:32:36 +0200 Subject: [PATCH 7/7] better Dockerfile comments from Carol --- Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f002e1f1..5eaed69a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,22 @@ -# An incomplete base docker image for running JupyterHub +# An incomplete base Docker image for running JupyterHub # -# Build your own derivative images starting with +# Add your configuration to create a complete derivative Docker image. +# +# Include your configuration settings by starting with one of two options: +# +# Option 1: # # FROM jupyterhub/jupyterhub:latest # -# And put your jupyterhub_config.py in /srv/jupyterhub/jupyterhub_config.py. +# And put your configuration file jupyterhub_config.py in /srv/jupyterhub/jupyterhub_config.py. +# +# Option 2: # # Or you can create your jupyterhub config and database on the host machine, and mount it with: # # docker run -v $PWD:/srv/jupyterhub -t jupyterhub/jupyterhub # +# NOTE # If you base on jupyterhub/jupyterhub-onbuild # your jupyterhub_config.py will be added automatically # from your docker directory.