-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
153 lines (135 loc) · 4.22 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
.DEFAULT_GOAL := build
SHELL := /bin/bash
, := ,
include docker.mk
include rootcmd.mk
include test-exec.mk
down_%:
$(DOCKER) rm -f -v $(shell cat $*.cid)
rm -f $*.cid
.PHONY: up
up: db.cid manager.cid
DOCKER_RUN := $(DOCKER) run -d \
--dns=172.17.42.1
db.cid:
$(DOCKER_RUN) \
--cidfile=$@ \
-e POSTGRES_PASSWORD=postgres \
postgres:9.4
manager.cid: db.cid
$(DOCKER_RUN) \
--cidfile=$@ \
--link='$(shell cat db.cid):db' \
-P \
--volume='$(abspath parcel-repo):/opt/cloudera/parcel-repo' \
storm-cm/manager
agent%.cid: manager.cid db.cid
$(DOCKER_RUN) \
--cidfile=$@ \
--link='$(shell cat db.cid):db' \
storm-cm/agent
.PHONY: build
build: docker_storm-cm/manager docker_storm-cm/agent
.PHONY: docker_storm-cm/manager
docker_storm-cm/manager: docker_storm-cm/host
$(call docker-build)
.PHONY: docker_storm-cm/agent
docker_storm-cm/agent: docker_storm-cm/host
$(call docker-build)
.PHONY: docker_storm-cm/host
docker_storm-cm/host: $(call test-docker-image,storm-cm/host.tmp) $(addprefix host/,local_policy.jar US_export_policy.jar cloudera.gpg)
$(call docker-build)
host/cloudera.gpg: $(call test-docker-image,storm-cm/debian)
$(DOCKER) run \
-t \
--rm \
-v $(abspath $(dir $@)):/build \
-w /root \
storm-cm/debian \
bash -c $$'\
set -x; \
gpg --no-default-keyring --keyring $$(readlink -f $(notdir $@)) --import < /build/archive.key; \
chmod 0644 $(notdir $@); \
mv -t /build $(notdir $@); \
'
host/local_policy.jar: host/jce_policy-8.zip
host/US_export_policy.jar: host/jce_policy-8.zip
# Note that the jars are copied, and the zip is moved; this ensures that the
# modification time of the zip is older than that of the jars; hence make will
# not think that the jar targets are outdated.
host/jce_policy-8.zip: $(call test-docker-image,storm-cm/debian)
$(DOCKER) run \
-t \
--rm \
-v $(abspath $(dir $@)):/build \
-w /root \
storm-cm/debian \
bash -c $$'\
set -eu; \
apt-get -q update; \
DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends ca-certificates wget unzip; \
wget \
--header \'Cookie: oraclelicense=accept-securebackup-cookie\' \
https://edelivery.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip; \
unzip -j -d . jce_policy-8.zip UnlimitedJCEPolicyJDK8/{local,US_export}_policy.jar; \
cp -t /build *.jar; \
mv -t /build jce_policy-8.zip; \
'
docker_storm-cm/host.tmp: $(call test-docker-image,storm-cm/debian) host/oracle-java8-jre_8u40_amd64.deb
set -eu; \
if [[ -f host.tmp.cid ]]; then \
$(DOCKER) rm -v $$(<host.tmp.cid) || :; \
rm host.tmp.cid; \
fi
$(DOCKER) run \
--cidfile=host.tmp.cid \
-i \
-w /root \
storm-cm/debian \
bash -c $$'\
set -eu; \
deb='$(notdir $(filter %.deb,$^))'; \
cat /dev/stdin > "$$deb"; \
dpkg -i "$$deb"; \
' < $(filter %.deb,$^)
$(DOCKER) commit \
$$(<host.tmp.cid) \
$(patsubst docker_%,%,$@)
$(DOCKER) rm -v $$(<host.tmp.cid)
rm host.tmp.cid
host/oracle-java8-jre_8u40_amd64.deb: $(call test-docker-image,storm-cm/debian) host/jre-8u40-linux-x64.tar.gz
$(DOCKER) run \
-t \
--rm \
-v $(abspath $(dir $@)):/build \
-w /tmp \
storm-cm/debian \
bash -c $$'\
set -eux; \
echo \'deb http://http.debian.net/debian wheezy-backports main contrib non-free\' > /etc/apt/sources.list.d/backports.list; \
apt-get -q update; \
DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends java-package/wheezy-backports gcc; \
yes | su -s /bin/sh -c \'make-jpkg /build/jre-8u40-linux-x64.tar.gz\' nobody; \
mv -t /build $(notdir $@); \
'
host/jre-8u40-linux-x64.tar.gz: $(call test-docker-image,storm-cm/debian)
$(DOCKER) run \
-t \
--rm \
-v $(abspath $(dir $@)):/build \
-w /root \
storm-cm/debian \
bash -c $$'\
set -eux; \
apt-get -q update; \
DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends ca-certificates wget; \
wget --progress=dot:mega --header \'Cookie: oraclelicense=accept-securebackup-cookie\' https://edelivery.oracle.com/otn-pub/java/jdk/8u40-b26/jre-8u40-linux-x64.tar.gz; \
mv -t /build $(notdir $@); \
'
$(eval $(call docker-mkimage,storm-cm/debian,\
debootstrap \
--variant=minbase \
--components=main$(,)contrib$(,)non-free \
wheezy \
http://http.debian.net/debian \
))