-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
48 lines (37 loc) · 1.26 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
arch=$(shell arch)
ifeq ($(arch),x86_64)
arch=amd64
endif
DOCKER_REPO = cwpearson/ece408_mxnet_docker
COMMIT = $(shell git rev-parse --short HEAD)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
REPO_PREFIX = $(DOCKER_REPO):$(arch)
GPU_LATEST = $(REPO_PREFIX)-gpu-latest
GPU_BRANCH_LATEST = $(REPO_PREFIX)-gpu-$(BRANCH)-latest
GPU_COMMIT = $(REPO_PREFIX)-gpu-$(COMMIT)
CPU_LATEST = $(REPO_PREFIX)-cpu-latest
CPU_BRANCH_LATEST = $(REPO_PREFIX)-cpu-$(BRANCH)-latest
CPU_COMMIT = $(REPO_PREFIX)-cpu-$(COMMIT)
all: build
build: build_cpu build_gpu
build_and_push: build_and_push_cpu build_and_push_gpu
.PHONY: build_gpu
build_gpu:
docker pull carml/base:$(arch)-gpu-latest
docker build . -f Dockerfile.$(arch)_gpu -t $(GPU_LATEST)
docker tag $(GPU_LATEST) $(GPU_BRANCH_LATEST)
docker tag $(GPU_LATEST) $(GPU_COMMIT)
.PHONY: build_cpu
build_cpu:
docker pull carml/go-mxnet:$(arch)-cpu-latest
docker build . -f Dockerfile.$(arch)_cpu -t $(CPU_LATEST)
docker tag $(CPU_LATEST) $(CPU_BRANCH_LATEST)
docker tag $(CPU_LATEST) $(CPU_COMMIT)
build_and_push_cpu: build_cpu
docker push $(CPU_LATEST)
docker push $(CPU_BRANCH_LATEST)
docker push $(CPU_COMMIT)
build_and_push_gpu: build_gpu
docker push $(GPU_LATEST)
docker push $(GPU_BRANCH_LATEST)
docker push $(GPU_COMMIT)