Compute nodes can run jobs - almost. The final arv-put --raw in the
[arvados.git] / docker / build_tools / Makefile
1 all: api-image compute-image doc-image workbench-image keep-image sso-image
2
3 # `make clean' removes the files generated in the build directory
4 # but does not remove any docker images generated in previous builds
5 clean:
6         -rm -rf build
7         -rm *-image */generated/*
8         -@rmdir */generated
9
10 # `make realclean' will also remove the docker images and force
11 # subsequent makes to build the entire chain from the ground up
12 realclean: clean
13         -[ -n "`$(DOCKER) ps -q`" ] && $(DOCKER) stop `$(DOCKER) ps -q`
14         -$(DOCKER) rm `$(DOCKER) ps -a |grep -e arvados -e api_server -e keep_server -e doc_server -e workbench_server |cut -f 1 -d' '`
15         -$(DOCKER) rmi `$(DOCKER) images -q arvados/*`
16
17 # ============================================================
18 # Dependencies for */generated files which are prerequisites
19 # for building docker images.
20
21 CONFIG_RB = build_tools/config.rb
22
23 BUILD = build/.buildstamp
24
25 BASE_DEPS = base/Dockerfile $(BASE_GENERATED)
26
27 SLURM_DEPS = slurm/Dockerfile $(SLURM_GENERATED)
28
29 JOBS_DEPS = jobs/Dockerfile
30
31 JAVA_BWA_SAMTOOLS_DEPS = java-bwa-samtools/Dockerfile
32
33 API_DEPS = api/* $(API_GENERATED)
34
35 COMPUTE_DEPS = compute/* $(COMPUTE_GENERATED)
36
37 DOC_DEPS = doc/Dockerfile doc/apache2_vhost
38
39 WORKBENCH_DEPS = workbench/Dockerfile \
40                  $(WORKBENCH_GENERATED)
41
42 KEEP_DEPS = keep/Dockerfile
43
44 SSO_DEPS = $(SSO_GENERATED)
45
46 BCBIO_NEXTGEN_DEPS = bcbio-nextgen/Dockerfile
47
48 BASE_GENERATED = base/generated/arvados.tar.gz
49
50 SLURM_GENERATED = slurm/generated/*
51
52 COMPUTE_GENERATED = compute/generated/setup.sh
53
54 COMPUTE_GENERATED_IN = compute/setup.sh.in
55
56 API_GENERATED = \
57         api/generated/apache2_vhost \
58         api/generated/config_databases.sh \
59         api/generated/database.yml \
60         api/generated/omniauth.rb \
61         api/generated/application.yml \
62         api/generated/setup.sh \
63         api/generated/slurm.conf \
64         api/generated/superuser_token
65
66 API_GENERATED_IN = \
67         api/apache2_vhost.in \
68         api/config_databases.sh.in \
69         api/database.yml.in \
70         api/omniauth.rb.in \
71         api/application.yml.in \
72         api/setup.sh.in \
73         api/slurm.conf.in \
74         api/superuser_token.in
75
76 SLURM_GENERATED = \
77         slurm/generated/slurm.conf
78
79 SLURM_GENERATED_IN = \
80         slurm/slurm.conf.in
81
82 WORKBENCH_GENERATED = \
83         workbench/generated/apache2_vhost \
84         workbench/generated/application.yml
85
86 WORKBENCH_GENERATED_IN = \
87         workbench/apache2_vhost.in \
88         workbench/application.yml.in
89
90 SSO_GENERATED = \
91         sso/generated/apache2_vhost \
92         sso/generated/seeds.rb \
93         sso/generated/secret_token.rb
94
95 SSO_GENERATED_IN = \
96         sso/apache2_vhost.in \
97         sso/seeds.rb.in \
98         sso/secret_token.rb.in
99
100 $(BUILD):
101         mkdir -p build
102         rsync -rlp --exclude=docker/ --exclude='**/log/*' --exclude='**/tmp/*' \
103                 --chmod=Da+rx,Fa+rX ../ build/
104         find build/ -name \*.gem -delete
105         cd build/services/fuse/ && python setup.py build
106         cd build/sdk/python/ && python setup.py build
107         cd build/sdk/cli && gem build arvados-cli.gemspec
108         cd build/sdk/ruby && gem build arvados.gemspec
109         touch build/.buildstamp
110
111 $(SLURM_GENERATED): config.yml $(BUILD)
112         $(CONFIG_RB)
113         mkdir -p slurm/generated
114
115 $(BASE_GENERATED): config.yml $(BUILD)
116         $(CONFIG_RB)
117         mkdir -p base/generated
118         tar -czf base/generated/arvados.tar.gz -C build .
119
120 $(API_GENERATED): config.yml $(API_GENERATED_IN)
121         $(CONFIG_RB)
122
123 $(WORKBENCH_GENERATED): config.yml $(WORKBENCH_GENERATED_IN)
124         $(CONFIG_RB)
125
126 $(COMPUTE_GENERATED): config.yml $(COMPUTE_GENERATED_IN)
127
128 $(WAREHOUSE_GENERATED): config.yml $(WAREHOUSE_GENERATED_IN)
129         $(CONFIG_RB)
130
131 $(SSO_GENERATED): config.yml $(SSO_GENERATED_IN)
132         $(CONFIG_RB)
133
134 # The docker build -q option suppresses verbose build output.
135 # Necessary to prevent failure on building warehouse; see
136 # https://github.com/dotcloud/docker/issues/3172
137 DOCKER_BUILD = $(DOCKER) build -q --rm=true
138
139 # ============================================================
140 # The main Arvados servers: api, doc, workbench, warehouse
141
142 api-image: passenger-image $(BUILD) $(API_DEPS)
143         mkdir -p api/generated
144         tar -czf api/generated/api.tar.gz -C build/services api
145         chmod 755 api/generated/setup.sh
146         $(DOCKER_BUILD) -t arvados/api api
147         date >api-image
148
149 slurm-image: base-image $(SLURM_DEPS)
150
151 compute-image: slurm-image $(BUILD) $(COMPUTE_DEPS)
152         chmod 755 compute/generated/setup.sh
153         $(DOCKER_BUILD) -t arvados/compute compute
154         date >compute-image
155
156 doc-image: base-image $(BUILD) $(DOC_DEPS)
157         mkdir -p doc/generated
158         tar -czf doc/generated/doc.tar.gz -C build doc
159         $(DOCKER_BUILD) -t arvados/doc doc
160         date >doc-image
161
162 keep-image: debian-image $(BUILD) $(KEEP_DEPS)
163         $(DOCKER_BUILD) -t arvados/keep keep
164         date >keep-image
165
166 jobs-image: base-image $(BUILD) $(JOBS_DEPS)
167         $(DOCKER_BUILD) -t arvados/jobs jobs
168         date >jobs-image
169
170 java-bwa-samtools-image: jobs-image $(BUILD) $(JAVA_BWA_SAMTOOLS_DEPS)
171         $(DOCKER_BUILD) -t arvados/jobs-java-bwa-samtools java-bwa-samtools
172         date >java-bwa-samtools-image
173
174 bcbio-nextgen-image: $(BUILD) $(BASE_GENERATED) $(BCBIO_NEXTGEN_DEPS)
175         rm -rf bcbio-nextgen/generated
176         cp -r base/generated bcbio-nextgen
177         $(DOCKER_BUILD) -t arvados/bcbio-nextgen bcbio-nextgen
178         date >bcbio-nextgen-image
179
180 workbench-image: passenger-image $(BUILD) $(WORKBENCH_DEPS)
181         mkdir -p workbench/generated
182         tar -czf workbench/generated/workbench.tar.gz -C build/apps workbench
183         $(DOCKER_BUILD) -t arvados/workbench workbench
184         date >workbench-image
185
186 warehouse-image: base-image $(WAREHOUSE_DEPS)
187         $(DOCKER_BUILD) -t arvados/warehouse warehouse
188         date >warehouse-image
189
190 sso-image: passenger-image $(SSO_DEPS)
191         $(DOCKER_BUILD) -t arvados/sso sso
192         date >sso-image
193
194 # ============================================================
195 # The arvados/base image is the base Debian image plus packages
196 # that are dependencies for every Arvados service.
197
198 passenger-image: base-image
199         $(DOCKER_BUILD) -t arvados/passenger passenger
200         date >passenger-image
201
202 slurm-image: base-image $(SLURM_DEPS)
203         $(DOCKER_BUILD) -t arvados/slurm slurm
204         date >slurm-image
205
206 base-image: debian-image $(BASE_DEPS)
207         $(DOCKER_BUILD) -t arvados/base base
208         date >base-image
209
210 debian-image:
211         ./mkimage-debootstrap.sh arvados/debian wheezy ftp://ftp.us.debian.org/debian/
212         date >debian-image