added shell-image back again to the build. I checked on my local machine and works...
[arvados.git] / docker / build_tools / Makefile
1 # This is the 'shell hack'. Call make with DUMP=1 to see the effect.
2 ifdef DUMP
3 OLD_SHELL := $(SHELL)
4 SHELL = $(warning [$@])$(OLD_SHELL) -x
5 endif
6
7 all: skydns-image skydock-image api-image compute-image doc-image workbench-image keep-image keep-proxy-image sso-image shell-image
8
9 IMAGE_FILES := $(shell ls *-image 2>/dev/null |grep -v -E 'debian-arvados-image|skydns-image|skydock-image')
10 GENERATED_DIRS := $(shell ls */generated 2>/dev/null)
11
12 # `make clean' removes the files generated in the build directory
13 # but does not remove any docker images generated in previous builds
14 clean:
15         @echo "make clean"
16         -@rm -rf build
17         +@[ "$(IMAGE_FILES)" = "" ] || rm -f $(IMAGE_FILES) 2>/dev/null
18         +@[ "$(GENERATED_DIRS)" = "" ] || rm -rf */generated 2>/dev/null
19
20 DEBIAN_IMAGE := $(shell $(DOCKER) images -q arvados/debian |head -n1)
21
22 REALCLEAN_CONTAINERS := $(shell $(DOCKER) ps -a |grep -e arvados -e api_server -e keep_server -e keep_proxy_server -e doc_server -e workbench_server |cut -f 1 -d' ')
23 REALCLEAN_IMAGES := $(shell $(DOCKER) images -q arvados/* |grep -v $(DEBIAN_IMAGE) 2>/dev/null)
24 DEEPCLEAN_IMAGES := $(shell $(DOCKER) images -q arvados/*)
25 SKYDNS_CONTAINERS := $(shell $(DOCKER) ps -a |grep -e crosbymichael/skydns -e crosbymichael/skydock |cut -f 1 -d' ')
26 SKYDNS_IMAGES := $(shell $(DOCKER) images -q crosbymichael/skyd*)
27
28 # `make realclean' will also remove the Arvados docker images (but not the
29 # arvados/debian image) and force subsequent makes to build the entire chain
30 # from the ground up
31 realclean: clean
32         @echo "make realclean"
33         +@[ "`$(DOCKER) ps -q`" = '' ] || $(DOCKER) stop `$(DOCKER) ps -q`
34         +@[ "$(REALCLEAN_CONTAINERS)" = '' ] || $(DOCKER) rm $(REALCLEAN_CONTAINERS)
35         +@[ "$(REALCLEAN_IMAGES)" = '' ] || $(DOCKER) rmi $(REALCLEAN_IMAGES)
36
37 # `make deepclean' will remove all Arvados docker images and the skydns/skydock
38 # images and force subsequent makes to build the entire chain from the ground up
39 deepclean: clean
40         @echo "make deepclean"
41         -@rm -f debian-arvados-image 2>/dev/null
42         -@rm -f skydns-image skydock-image 2>/dev/null
43         +@[ "`$(DOCKER) ps -q`" = '' ] || $(DOCKER) stop `$(DOCKER) ps -q`
44         +@[ "$(REALCLEAN_CONTAINERS)" = '' ] || $(DOCKER) rm $(REALCLEAN_CONTAINERS)
45         +@[ "$(DEEPCLEAN_IMAGES)" = '' ] || $(DOCKER) rmi $(DEEPCLEAN_IMAGES)
46         +@[ "$(SKYDNS_CONTAINERS)" = '' ] || $(DOCKER) rm $(SKYDNS_CONTAINERS)
47         +@[ "$(SKYDNS_IMAGES)" = '' ] || $(DOCKER) rmi $(SKYDNS_IMAGES)
48
49 # ============================================================
50 # Dependencies for */generated files which are prerequisites
51 # for building docker images.
52
53 CONFIG_RB = build_tools/config.rb
54
55 BUILD = build/.buildstamp
56
57 BASE_DEPS = base/Dockerfile config.yml $(BASE_GENERATED)
58
59 SLURM_DEPS = slurm/Dockerfile config.yml $(SLURM_GENERATED)
60
61 JOBS_DEPS = jobs/Dockerfile
62
63 ARV_WEB_DEPS = arv-web/Dockerfile arv-web/apache2_foreground.sh arv-web/apache2_vhost
64
65 JAVA_BWA_SAMTOOLS_DEPS = java-bwa-samtools/Dockerfile
66
67 API_DEPS = api/* config.yml $(API_GENERATED)
68
69 SHELL_DEPS = shell/* config.yml $(SHELL_GENERATED)
70
71 COMPUTE_DEPS = compute/* config.yml $(COMPUTE_GENERATED)
72
73 DOC_DEPS = doc/Dockerfile $(DOC_GENERATED)
74
75 WORKBENCH_DEPS = workbench/Dockerfile \
76                  config.yml \
77                  $(WORKBENCH_GENERATED)
78
79 KEEP_DEPS = keep/Dockerfile config.yml $(KEEP_GENERATED)
80
81 KEEP_PROXY_DEPS = keepproxy/Dockerfile config.yml $(KEEP_PROXY_GENERATED)
82
83 SSO_DEPS = config.yml $(SSO_GENERATED)
84
85 BCBIO_NEXTGEN_DEPS = bcbio-nextgen/Dockerfile
86
87 BASE_GENERATED = base/generated/arvados.tar.gz
88
89 COMPUTE_GENERATED_IN   = compute/*.in
90 COMPUTE_GENERATED      = compute/generated/*
91
92 KEEP_GENERATED_IN      = keep/*.in
93 KEEP_GENERATED         = keep/generated/*
94
95 KEEP_PROXY_GENERATED_IN      = keepproxy/*.in
96 KEEP_PROXY_GENERATED         = keepproxy/generated/*
97
98 API_GENERATED_IN       = api/*.in
99 API_GENERATED          = api/generated/*
100
101 SHELL_GENERATED_IN     = shell/*.in
102 SHELL_GENERATED        = shell/generated/*
103
104 SLURM_GENERATED_IN     = slurm/*.in
105 SLURM_GENERATED        = slurm/generated/*
106
107 WORKBENCH_GENERATED_IN = workbench/*.in
108 WORKBENCH_GENERATED    = workbench/generated/*
109
110 SSO_GENERATED_IN       = sso/*.in
111 SSO_GENERATED          = sso/generated/*
112
113 DOC_GENERATED_IN       = doc/*.in
114 DOC_GENERATED          = doc/generated/*
115
116 KEEP_DEPS += keep/generated/bin/keepproxy
117 KEEP_DEPS += keep/generated/bin/keepstore
118 keep/generated/bin/%: $(wildcard build/services/%/*.go)
119         mkdir -p keep/generated/src/git.curoverse.com
120         ln -sfn ../../../../.. keep/generated/src/git.curoverse.com/arvados.git
121         GOPATH=$(shell pwd)/keep/generated go get $(@:keep/generated/bin/%=git.curoverse.com/arvados.git/services/%)
122
123 KEEP_PROXY_DEPS += keepproxy/generated/bin/keepproxy
124 keepproxy/generated/bin/%: $(wildcard build/services/%/*.go)
125         mkdir -p keepproxy/generated/src/git.curoverse.com
126         ln -sfn ../../../../.. keepproxy/generated/src/git.curoverse.com/arvados.git
127         GOPATH=$(shell pwd)/keepproxy/generated go get $(@:keepproxy/generated/bin/%=git.curoverse.com/arvados.git/services/%)
128
129 $(BUILD):
130         mkdir -p build
131         rsync -rlp --exclude=docker/ --exclude='**/log/*' --exclude='**/tmp/*' \
132                 --chmod=Da+rx,Fa+rX ../ build/
133         find build/ -name \*.gem -delete
134         cd build/services/fuse/ && python setup.py build
135         cd build/sdk/python/ && python setup.py build
136         cd build/sdk/cli && gem build arvados-cli.gemspec
137         cd build/sdk/ruby && gem build arvados.gemspec
138         touch build/.buildstamp
139
140 $(SLURM_GENERATED): $(BUILD)
141         $(CONFIG_RB) slurm
142         mkdir -p slurm/generated
143
144 $(BASE_GENERATED): $(BUILD)
145         $(CONFIG_RB) base
146         mkdir -p base/generated
147         tar -czf base/generated/arvados.tar.gz -C build .
148
149 $(API_GENERATED): $(API_GENERATED_IN)
150         $(CONFIG_RB) api
151
152 $(SHELL_GENERATED): $(SHELL_GENERATED_IN)
153         $(CONFIG_RB) shell
154
155 $(WORKBENCH_GENERATED): $(WORKBENCH_GENERATED_IN)
156         $(CONFIG_RB) workbench
157
158 $(COMPUTE_GENERATED): $(COMPUTE_GENERATED_IN)
159         $(CONFIG_RB) compute
160
161 $(SSO_GENERATED): $(SSO_GENERATED_IN)
162         $(CONFIG_RB) sso
163
164 $(DOC_GENERATED): $(DOC_GENERATED_IN)
165         $(CONFIG_RB) doc
166
167 $(KEEP_GENERATED): $(KEEP_GENERATED_IN)
168         $(CONFIG_RB) keep
169
170 $(KEEP_PROXY_GENERATED): $(KEEP_PROXY_GENERATED_IN)
171         $(CONFIG_RB) keepproxy
172
173 DOCKER_BUILD = $(DOCKER) build --rm=true
174
175 # ============================================================
176 # The main Arvados servers: api, doc, workbench, compute
177
178 api-image: passenger-image $(BUILD) $(API_DEPS)
179         @echo "Building api-image"
180         mkdir -p api/generated
181         tar -czf api/generated/api.tar.gz -C build/services api
182         $(DOCKER_BUILD) -t arvados/api api
183         date >api-image
184
185 shell-image: base-image $(BUILD) $(SHELL_DEPS)
186         @echo "Building shell-image"
187         mkdir -p shell/generated
188         $(DOCKER_BUILD) -t arvados/shell shell
189         date >shell-image
190
191 compute-image: slurm-image $(BUILD) $(COMPUTE_DEPS)
192         @echo "Building compute-image"
193         $(DOCKER_BUILD) -t arvados/compute compute
194         date >compute-image
195
196 doc-image: base-image $(BUILD) $(DOC_DEPS)
197         @echo "Building doc-image"
198         mkdir -p doc/generated
199         tar -czf doc/generated/doc.tar.gz -C build doc
200         $(DOCKER_BUILD) -t arvados/doc doc
201         date >doc-image
202
203 keep-image: debian-arvados-image $(BUILD) $(KEEP_DEPS)
204         @echo "Building keep-image"
205         $(DOCKER_BUILD) -t arvados/keep keep
206         date >keep-image
207
208 keep-proxy-image: debian-arvados-image $(BUILD) $(KEEP_PROXY_DEPS)
209         @echo "Building keep-proxy-image"
210         $(DOCKER_BUILD) -t arvados/keepproxy keepproxy
211         date >keep-proxy-image
212
213 jobs-image: base-image $(BUILD) $(JOBS_DEPS)
214         $(DOCKER_BUILD) -t arvados/jobs jobs
215         date >jobs-image
216
217 java-bwa-samtools-image: jobs-image $(BUILD) $(JAVA_BWA_SAMTOOLS_DEPS)
218         $(DOCKER_BUILD) -t arvados/jobs-java-bwa-samtools java-bwa-samtools
219         date >java-bwa-samtools-image
220
221 bcbio-nextgen-image: $(BUILD) $(BASE_GENERATED) $(BCBIO_NEXTGEN_DEPS)
222         rm -rf bcbio-nextgen/generated
223         cp -r base/generated bcbio-nextgen
224         $(DOCKER_BUILD) -t arvados/bcbio-nextgen bcbio-nextgen
225         date >bcbio-nextgen-image
226
227 workbench-image: passenger-image $(BUILD) $(WORKBENCH_DEPS)
228         @echo "Building workbench-image"
229         mkdir -p workbench/generated
230         tar -czf workbench/generated/workbench.tar.gz -C build/apps workbench
231         $(DOCKER_BUILD) -t arvados/workbench workbench
232         date >workbench-image
233
234 sso-image: passenger-image $(SSO_DEPS)
235         @echo "Building sso-image"
236         $(DOCKER_BUILD) -t arvados/sso sso
237         date >sso-image
238
239 arv-web-image: passenger-image $(ARV_WEB_DEPS)
240         $(DOCKER_BUILD) -t arvados/arv-web arv-web
241         date >arv-web-image
242
243 # ============================================================
244 # The arvados/base image is the base Debian image plus packages
245 # that are dependencies for every Arvados service.
246
247 passenger-image: base-image
248         @echo "Building passenger-image"
249         $(DOCKER_BUILD) -t arvados/passenger passenger
250         date >passenger-image
251
252 slurm-image: base-image $(SLURM_DEPS)
253         @echo "Building slurm-image"
254         $(DOCKER_BUILD) -t arvados/slurm slurm
255         date >slurm-image
256
257 base-image: debian-arvados-image $(BASE_DEPS)
258         @echo "Building base-image"
259         $(DOCKER_BUILD) -t arvados/base base
260         date >base-image
261
262 debian-arvados-image:
263         @echo "Building debian-arvados-image"
264         ./mkimage-debootstrap.sh arvados/debian wheezy ftp://ftp.us.debian.org/debian/
265         date >debian-arvados-image
266
267 skydns-image:
268         @echo "Downloading skydns-image"
269         $(DOCKER) pull crosbymichael/skydns
270         date >skydns-image
271
272 skydock-image:
273         @echo "Downloading skydock-image"
274         $(DOCKER) pull crosbymichael/skydock
275         date >skydock-image