118 lines
2.8 KiB
YAML
118 lines
2.8 KiB
YAML
# Copyright (c) Jupyter Development Team.
|
|
# Distributed under the terms of the Modified BSD License.
|
|
|
|
# JupyterHub docker-compose configuration file
|
|
version: "3"
|
|
|
|
services:
|
|
hub-db:
|
|
image: postgres:9.5
|
|
container_name: jupyterhub-db
|
|
restart: always
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
PGDATA: ${DB_VOLUME_CONTAINER}
|
|
env_file:
|
|
- secrets/postgres.env
|
|
volumes:
|
|
- "db:${DB_VOLUME_CONTAINER}"
|
|
networks:
|
|
- reverseproxy
|
|
|
|
hub:
|
|
depends_on:
|
|
- hub-db
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.jupyterhub
|
|
args:
|
|
JUPYTERHUB_VERSION: ${JUPYTERHUB_VERSION}
|
|
restart: always
|
|
image: jupyterhub
|
|
container_name: jupyterhub
|
|
volumes:
|
|
# Bind Docker socket on the host so we can connect to the daemon from
|
|
# within the container
|
|
- "/var/run/docker.sock:/var/run/docker.sock:rw"
|
|
# Bind Docker volume on host for JupyterHub database and cookie secrets
|
|
- "data:${DATA_VOLUME_CONTAINER}"
|
|
ports:
|
|
- "8000:8000"
|
|
networks:
|
|
- reverseproxy
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.frontend.rule=Host:hub.docker.localhost"
|
|
links:
|
|
- hub-db
|
|
environment:
|
|
# All containers will join this network
|
|
DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME}
|
|
# JupyterHub will spawn this Notebook image for users
|
|
DOCKER_NOTEBOOK_IMAGE: ${LOCAL_NOTEBOOK_IMAGE}
|
|
# Notebook directory inside user image
|
|
DOCKER_NOTEBOOK_DIR: ${DOCKER_NOTEBOOK_DIR}
|
|
# Using this run command (optional)
|
|
DOCKER_SPAWN_CMD: ${DOCKER_SPAWN_CMD}
|
|
# Postgres db info
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_HOST: hub-db
|
|
env_file:
|
|
- secrets/postgres.env
|
|
- secrets/oauth.env
|
|
command: >
|
|
jupyterhub -f /srv/jupyterhub/jupyterhub_config.py
|
|
|
|
traefik:
|
|
image: traefik:latest
|
|
container_name: reverse-proxy
|
|
networks:
|
|
- reverseproxy
|
|
cap_drop:
|
|
- all
|
|
cap_add:
|
|
- net_bind_service
|
|
ports:
|
|
- 80:80
|
|
- 443:443
|
|
- 8080:8080
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- $PWD/traefik.toml:/traefik.toml
|
|
- $PWD/secrets/acme.json:/acme.json
|
|
|
|
|
|
nginx:
|
|
image: nginx:latest
|
|
container_name: nginx
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.frontend.rule=Host:consistentbayes.com
|
|
- traefik.backend=nginx
|
|
- traefik.docker.network=reverseproxy
|
|
- traefik.port=80
|
|
networks:
|
|
- reverseproxy
|
|
- internal
|
|
volumes:
|
|
- ./public_html:/usr/share/nginx/html
|
|
|
|
volumes:
|
|
data:
|
|
external:
|
|
name: ${DATA_VOLUME_HOST}
|
|
db:
|
|
external:
|
|
name: ${DB_VOLUME_HOST}
|
|
|
|
networks:
|
|
default:
|
|
external:
|
|
name: ${DOCKER_NETWORK_NAME}
|
|
reverseproxy:
|
|
external:
|
|
name: reverseproxy
|
|
internal:
|
|
external: false
|
|
|