forked from kajyuuen/lab-dockerfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (41 loc) · 1.01 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
TYPE = GPU
IMAGE_NAME = $(USER)-lab-image
CONTAINER_NAME = $(USER)-lab-container
.PHONY: build
build:
docker build . -t $(IMAGE_NAME)
.PHONY: run
run:
nvidia-docker run -itd --name $(CONTAINER_NAME) \
-v $(HOST_DIRECTORY):/code \
-p $(HOST_PORT):8888 $(IMAGE_NAME) \
jupyter notebook --ip=0.0.0.0 --port=8888 --allow-root --notebook-dir=/code
.PHONY: exec
exec:
docker exec -it $(CONTAINER_NAME) /bin/bash
# Clean
.PHONY: all-clean
all-clean:
make stop
make container-clean
make image-clean
.PHONY: image-clean
image-clean:
docker rmi `docker images -q $(IMAGE_NAME)`
.PHONY: container-clean
container-clean:
docker rm `docker ps -aq --filter name=$(CONTAINER_NAME)`
.PHONY: stop
stop:
docker stop $(CONTAINER_NAME)
.PHONY: notebook-url
notebook-url:
docker logs $(CONTAINER_NAME) | head
@echo HOST_PORT: $(HOST_PORT)
.PHONY: config
config:
@echo TYPE: $(TYPE)
@echo IMAGE_NAME: $(IMAGE_NAME)
@echo CONTAINER_NAME: $(CONTAINER_NAME)
@echo HOST_DIRECTORY: $(HOST_DIRECTORY)
@echo HOST_PORT: $(HOST_PORT)