-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
37 lines (35 loc) · 1.49 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
# COMMANDS
DOCKER_COMMAND=docker
NVIDIA_DOCKER_COMMAND=nvidia-docker
CPU_DOCKER_FILE=Dockerfile.cpu
GPU_DOCKER_FILE=Dockerfile.gpu
SVC=tensorflow-opencv-py3
VERSION_CPU=latest-cpu
VERSION_GPU=latest-gpu
REGISTRY_URL=so77id
build-cpu bc:
@echo "[build] Building cpu docker image..."
@$(DOCKER_COMMAND) build -t $(REGISTRY_URL)/$(SVC):$(VERSION_CPU) -f $(CPU_DOCKER_FILE) .
@echo "[build] Delete old versions..."
@$(DOCKER_COMMAND) images|sed "1 d"|grep "<none> *<none>"|awk '{print $$3}'|sort|uniq|xargs $(DOCKER_COMMAND) rmi -f
build-gpu bg:
@echo "[build] Building gpu docker image..."
@$(DOCKER_COMMAND) build -t $(REGISTRY_URL)/$(SVC):$(VERSION_GPU) -f $(GPU_DOCKER_FILE) .
@echo "[build] Delete old versions..."
@$(DOCKER_COMMAND) images|sed "1 d"|grep "<none> *<none>"|awk '{print $$3}'|sort|uniq|xargs $(DOCKER_COMMAND) rmi -f
run-cpu rc:
@echo "[run] Running cpu docker image..."
@$(DOCKER_COMMAND) run -t -i $(REGISTRY_URL)/$(SVC):$(VERSION_CPU)
run-gpu rg:
@echo "[run] Running gpu docker image..."
@$(NVIDIA_DOCKER_COMMAND) run -t -i $(REGISTRY_URL)/$(SVC):$(VERSION_GPU)
upload-cpu uc:
@echo "[upload] Uploading cpu docker image..."
@$(DOCKER_COMMAND) push $(REGISTRY_URL)/$(SVC):$(VERSION_CPU)
upload-gpu ug:
@echo "[upload] Uploading gpu docker image..."
@$(DOCKER_COMMAND) push $(REGISTRY_URL)/$(SVC):$(VERSION_GPU)
clean c:
@echo "[clean] Cleaning docker images..."
@$(DOCKER_COMMAND) rmi -f $(REGISTRY_URL)/$(SVC):$(VERSION_CPU)
@$(DOCKER_COMMAND) rmi -f $(REGISTRY_URL)/$(SVC):$(VERSION_GPU)