This repository has been archived by the owner on Jan 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
/
Makefile
64 lines (50 loc) · 1.75 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
# Configuration parameters
CULL_PERIOD ?= 30
CULL_TIMEOUT ?= 60
CULL_MAX ?= 120
LOGGING ?= debug
POOL_SIZE ?= 5
DOCKER_HOST ?= 127.0.0.1
DOCKER_NETWORK_NAME ?= tmpnb
tmpnb-image: Dockerfile
docker build -t jupyter/tmpnb .
images: tmpnb-image demo-image minimal-image
minimal-image:
docker pull jupyter/minimal-notebook
demo-image:
docker pull jupyter/demo
proxy-image:
docker pull jupyter/configurable-http-proxy
network:
@docker network inspect $(DOCKER_NETWORK_NAME) >/dev/null 2>&1 || docker network create $(DOCKER_NETWORK_NAME)
proxy: proxy-image network
docker run -d -e CONFIGPROXY_AUTH_TOKEN=devtoken \
--network $(DOCKER_NETWORK_NAME) \
-p 8000:8000 \
-p 8001:8001 \
--name proxy \
jupyter/configurable-http-proxy \
--default-target http://tmpnb:9999 --api-ip 0.0.0.0
tmpnb: minimal-image tmpnb-image network
docker run -d -e CONFIGPROXY_AUTH_TOKEN=devtoken \
-e CONFIGPROXY_ENDPOINT=http://proxy:8001 \
--network $(DOCKER_NETWORK_NAME) \
--name tmpnb \
-v /var/run/docker.sock:/docker.sock jupyter/tmpnb python orchestrate.py \
--image=jupyter/minimal-notebook --cull_timeout=$(CULL_TIMEOUT) --cull_period=$(CULL_PERIOD) \
--logging=$(LOGGING) --pool_size=$(POOL_SIZE) --cull_max=$(CULL_MAX) \
--docker_network=$(DOCKER_NETWORK_NAME) \
--use_tokens=1
dev: cleanup network proxy tmpnb open
open:
docker ps | grep tmpnb
-open http:`echo $(DOCKER_HOST) | cut -d":" -f2`:8000
cleanup:
-docker stop `docker ps -aq --filter name=tmpnb --filter name=proxy --filter name=minimal-notebook`
-docker rm `docker ps -aq --filter name=tmpnb --filter name=proxy --filter name=minimal-notebook`
-docker images -q --filter "dangling=true" | xargs docker rmi
log-tmpnb:
docker logs -f tmpnb
log-proxy:
docker logs -f proxy
.PHONY: cleanup