forked from amancevice/docker-superset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (63 loc) · 2.13 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
IMAGE := amancevice/superset
STAGES := build dist final
CLEANS := $(foreach STAGE,$(STAGES),clean@$(STAGE))
IMAGES := $(foreach STAGE,$(STAGES),image@$(STAGE))
SHELLS := $(foreach STAGE,$(STAGES),shell@$(STAGE))
TIMESTAMP := $(shell date +%s)
NODE_VERSION := latest
PYTHON_VERSION := 3.6
SUPERSET_VERSION := 0.35.2
.PHONY: all clean clobber edge latest push $(IMAGES) $(SHELLS)
default: latest
.docker:
mkdir -p $@
.docker/$(SUPERSET_VERSION)-dist: .docker/$(SUPERSET_VERSION)-build
.docker/$(SUPERSET_VERSION)-final: .docker/$(SUPERSET_VERSION)-dist
.docker/$(SUPERSET_VERSION)-%: | .docker
docker build \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
--build-arg SUPERSET_VERSION=$(SUPERSET_VERSION) \
--iidfile $@@$(TIMESTAMP) \
--tag $(IMAGE):$(SUPERSET_VERSION)-$* \
--target $* \
.
cp $@@$(TIMESTAMP) $@
.docker/edge-dist: .docker/edge-build
.docker/edge-final: .docker/edge-dist
.docker/edge-%: | .docker
docker build \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
--build-arg SUPERSET_VERSION=master \
--iidfile $@@$(TIMESTAMP) \
--tag $(IMAGE):edge-$* \
--target $* \
.
cp $@@$(TIMESTAMP) $@
.docker/edge: .docker/edge-final
.docker/latest .docker/$(SUPERSET_VERSION): .docker/$(SUPERSET_VERSION)-final
.docker/%:
docker tag $(shell cat $<) $(IMAGE):$*
cp $< $@
clean:
-find .docker -name '$(SUPERSET_VERSION)-*' -not -name '*@*' | xargs rm
clobber:
-awk {print} .docker/* 2> /dev/null | uniq | xargs docker image rm --force
-rm -rf .docker
demo: .docker/$(SUPERSET_VERSION)
docker run --detach \
--name superset-$(SUPERSET_VERSION) \
--publish 8088:8088 \
$(shell cat $<)
docker exec -it superset-$(SUPERSET_VERSION) superset-demo
docker logs -f superset-$(SUPERSET_VERSION)
edge: .docker/edge
latest: .docker/latest .docker/$(SUPERSET_VERSION)
push:
-docker push $(IMAGE):$(SUPERSET_VERSION)
-docker push $(IMAGE):latest
-docker push $(IMAGE):edge
$(IMAGES): image@%: .docker/$(SUPERSET_VERSION)-%
$(SHELLS): shell@%: .docker/$(SUPERSET_VERSION)-%
docker run --rm -it --entrypoint /bin/bash $(shell cat $<)