-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
52 lines (38 loc) · 1.8 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
DEMOS := $(shell ls demos | grep -v java | grep -v py)
JAVA_DEMOS := $(patsubst java-%, %, $(shell ls demos | grep java))
PYTHON_DEMOS := $(patsubst python-%, %, $(shell ls demos | grep python))
IMAGE_PREFIX := qmstr
DEMO_IMAGES := $(foreach demo, $(DEMOS), $(demo)demo)
JAVADEMO_IMAGES := $(foreach demo, $(JAVA_DEMOS), java-$(demo)demo)
PYTHONDEMO_IMAGES := $(foreach demo, $(PYTHON_DEMOS), python-$(demo)demo)
ifdef http_proxy
DOCKER_PROXY = --build-arg http_proxy=$(http_proxy)
endif
all: $(DEMOS) $(JAVA_DEMOS) $(PYTHON_DEMOS)
.PHONY: demobase javademobase demoimage pythondemobase
demobase: container/Dockerfile
@echo "Building demo image"
cd container && docker build -t qmstr/demo --target demobase ${DOCKER_PROXY} $(EXTRA_BUILD_OPTS) .
container/Full%.Dockerfile: container/Dockerfile container/%.Dockerfile
cat $^ > $@
javademobase: container/FullJava.Dockerfile
@echo "Building java demo image"
docker build -f $^ -t qmstr/javademobase --target javademobase ${DOCKER_PROXY} $(EXTRA_BUILD_OPTS) container
pythondemobase: container/FullPython.Dockerfile
@echo "Building python demo image"
docker build -f $^ -t qmstr/pythondemobase --target pythondemobase ${DOCKER_PROXY} $(EXTRA_BUILD_OPTS) container
$(DEMO_IMAGES): demobase
@echo "Building image $@"
cd demos/$(@:%demo=%) && docker build -t $(IMAGE_PREFIX)/$@ ${DOCKER_PROXY} $(EXTRA_BUILD_OPTS) .
$(JAVADEMO_IMAGES): javademobase
@echo "Building image $@"
cd demos/$(@:%demo=%) && docker build -t $(IMAGE_PREFIX)/$@ ${DOCKER_PROXY} $(EXTRA_BUILD_OPTS) .
$(PYTHONDEMO_IMAGES): pythondemobase
@echo "Building image $@"
cd demos/$(@:%demo=%) && docker build -t $(IMAGE_PREFIX)/$@ ${DOCKER_PROXY} $(EXTRA_BUILD_OPTS) .
demos/%: %demo
@echo "running $@ demo"
$@/build.sh
$(DEMOS): %: demos/%
$(JAVA_DEMOS): %: demos/java-%
$(PYTHON_DEMOS): %: demos/python-%