Merge pull request #47 from minrk/08

Use JUPYTERHUB_VERSION as a build arg
This commit is contained in:
Min RK 2017-10-13 13:09:51 +02:00 committed by GitHub
commit c02a505d5b
5 changed files with 23 additions and 8 deletions

6
.env
View File

@ -7,6 +7,7 @@
# are not set in the shell environment.
# To override these values, set the shell environment variables.
JUPYTERHUB_VERSION=0.8.0
# Name of Docker machine
DOCKER_MACHINE_NAME=jupyterhub
@ -15,7 +16,10 @@ DOCKER_MACHINE_NAME=jupyterhub
DOCKER_NETWORK_NAME=jupyterhub-network
# Single-user Jupyter Notebook server container image
DOCKER_NOTEBOOK_IMAGE=jupyter/scipy-notebook:8f56e3c47fec
DOCKER_NOTEBOOK_IMAGE=jupyter/minimal-notebook:e1677043235c
# the local image we use, after pinning jupyterhub version
LOCAL_NOTEBOOK_IMAGE=jupyterhub-user
# Notebook directory in the container.
# This will be /home/jovyan/work if the default

View File

@ -1,13 +1,14 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
FROM jupyterhub/jupyterhub-onbuild:0.7.2
ARG JUPYTERHUB_VERSION
FROM jupyterhub/jupyterhub-onbuild:$JUPYTERHUB_VERSION
# Install dockerspawner, oauth, postgres
RUN /opt/conda/bin/conda install psycopg2=2.7 && \
RUN /opt/conda/bin/conda install -yq psycopg2=2.7 && \
/opt/conda/bin/conda clean -tipsy && \
/opt/conda/bin/pip install \
oauthenticator==0.6.* \
dockerspawner==0.8.*
/opt/conda/bin/pip install --no-cache-dir \
oauthenticator==0.7.* \
dockerspawner==0.9.*
# Copy TLS certificate and key
ENV SSL_CERT /srv/jupyterhub/secrets/jupyterhub.crt

View File

@ -50,7 +50,11 @@ check-files: userlist $(cert_files) secrets/oauth.env secrets/postgres.env
pull:
docker pull $(DOCKER_NOTEBOOK_IMAGE)
notebook_image: pull
notebook_image: pull singleuser/Dockerfile
docker build -t $(LOCAL_NOTEBOOK_IMAGE) \
--build-arg JUPYTERHUB_VERSION=$(JUPYTERHUB_VERSION) \
--build-arg DOCKER_NOTEBOOK_IMAGE=$(DOCKER_NOTEBOOK_IMAGE) \
singleuser
build: check-files network volumes
docker-compose build

View File

@ -23,6 +23,8 @@ services:
build:
context: .
dockerfile: Dockerfile.jupyterhub
args:
JUPYTERHUB_VERSION: ${JUPYTERHUB_VERSION}
restart: always
image: jupyterhub
container_name: jupyterhub
@ -40,7 +42,7 @@ services:
# All containers will join this network
DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME}
# JupyterHub will spawn this Notebook image for users
DOCKER_NOTEBOOK_IMAGE: ${DOCKER_NOTEBOOK_IMAGE}
DOCKER_NOTEBOOK_IMAGE: ${LOCAL_NOTEBOOK_IMAGE}
# Notebook directory inside user image
DOCKER_NOTEBOOK_DIR: ${DOCKER_NOTEBOOK_DIR}
# Using this run command (optional)

4
singleuser/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
ARG DOCKER_NOTEBOOK_IMAGE
FROM $DOCKER_NOTEBOOK_IMAGE
ARG JUPYTERHUB_VERSION
RUN python3 -m pip install --no-cache jupyterhub==$JUPYTERHUB_VERSION