forked from jupyterhub/jupyterhub-deploy-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
72 lines (54 loc) · 2.03 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
include .env
include nbgrader.env
.DEFAULT_GOAL=build
network:
@docker network inspect $(DOCKER_NETWORK_NAME) >/dev/null 2>&1 || docker network create $(DOCKER_NETWORK_NAME)
volumes:
@docker volume inspect $(DATA_VOLUME_HOST) >/dev/null 2>&1 || docker volume create --name $(DATA_VOLUME_HOST)
@docker volume inspect $(DB_VOLUME_HOST) >/dev/null 2>&1 || docker volume create --name $(DB_VOLUME_HOST)
self-signed-cert:
# make a self-signed cert
secrets/postgres.env:
@echo "Generating postgres password in $@"
@echo "POSTGRES_PASSWORD=$(shell openssl rand -hex 32)" > $@
secrets/oauth.env:
@echo "Need oauth.env file in secrets with GitHub parameters"
@exit 1
secrets/jupyterhub.crt:
@echo "Need an SSL certificate in secrets/jupyterhub.crt"
@exit 1
secrets/jupyterhub.key:
@echo "Need an SSL key in secrets/jupyterhub.key"
@exit 1
instructors.csv:
@echo "Add instructors to intructors.csv, check instructors-sample.csv"
@exit 1
students.csv:
@echo "Add students to students.csv, check students-sample.csv"
@exit 1
nbgrader.env:
@echo "Need nbgrader.env with nbgrader related env variables. See nbgrader-sample.env"
@exit 1
# Do not require cert/key files if SECRETS_VOLUME defined
secrets_volume = $(shell echo $(SECRETS_VOLUME))
ifeq ($(secrets_volume),)
cert_files=secrets/jupyterhub.crt secrets/jupyterhub.key
else
cert_files=
endif
check-files: instructors.csv students.csv $(cert_files) secrets/oauth.env secrets/postgres.env nbgrader.env
pull:
docker pull $(DOCKER_NOTEBOOK_IMAGE)
notebook_image: pull singleuser/Dockerfile
# Copy students.csv file in docker build context.
cp students.csv singleuser; \
docker build -t $(LOCAL_NOTEBOOK_IMAGE) \
--build-arg JUPYTERHUB_VERSION=$(JUPYTERHUB_VERSION) \
--build-arg DOCKER_NOTEBOOK_IMAGE=$(DOCKER_NOTEBOOK_IMAGE) \
singleuser; \
rm singleuser/students.csv
build: check-files network volumes
docker-compose build
.PHONY: network volumes check-files pull notebook_image build