diff --git a/Dockerfile b/Dockerfile index 80f29079..5eaed69a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,27 @@ -# 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 +# Add your configuration to create a complete derivative Docker image. # -# FROM jupyter/jupyterhub:latest +# Include your configuration settings by starting with one of two options: # +# Option 1: +# +# FROM jupyterhub/jupyterhub:latest +# +# 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. FROM debian:jessie - MAINTAINER Jupyter Project # install nodejs, utf8 locale @@ -22,7 +37,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 && \ @@ -32,21 +48,16 @@ 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/ +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/ - -# 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/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 diff --git a/circle.yml b/circle.yml index 0a3a1227..162fd16e 100644 --- a/circle.yml +++ b/circle.yml @@ -8,4 +8,12 @@ dependencies: test: override: - - docker build -t jupyter/jupyterhub . + - docker build -t jupyterhub/jupyterhub . + - docker build -t jupyterhub/jupyterhub-onbuild:${CIRCLE_TAG:-latest} onbuild + +deployment: + hub: + branch: master + commands: + - docker login -u $DOCKER_USER -p $DOCKER_PASS + - docker push jupyterhub/jupyterhub-onbuild:${CIRCLE_TAG:-latest} 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 diff --git a/onbuild/Dockerfile b/onbuild/Dockerfile new file mode 100644 index 00000000..f09febf0 --- /dev/null +++ b/onbuild/Dockerfile @@ -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 jupyterhub/jupyterhub + +ONBUILD ADD jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py + +CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"] 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.