1 all: api-image compute-image doc-image workbench-image keep-image sso-image shell-image
3 # `make clean' removes the files generated in the build directory
4 # but does not remove any docker images generated in previous builds
7 -rm `ls *-image |grep -v debian-arvados-image` */generated/*
10 DEBIAN_IMAGE := $(shell $(DOCKER) images -q arvados/debian |head -n1)
12 # `make realclean' will also remove the Arvados docker images (but not the
13 # arvados/debian image) and force subsequent makes to build the entire chain
16 -[ -n "`$(DOCKER) ps -q`" ] && $(DOCKER) stop `$(DOCKER) ps -q`
17 -$(DOCKER) rm `$(DOCKER) ps -a |grep -e arvados -e api_server -e keep_server -e doc_server -e workbench_server |cut -f 1 -d' '`
18 -$(DOCKER) rmi `$(DOCKER) images -q arvados/* |grep -v $(DEBIAN_IMAGE)`
20 # `make deepclean' will remove all Arvados docker images and force
21 # subsequent makes to build the entire chain from the ground up
23 -rm debian-arvados-image
24 -[ -n "`$(DOCKER) ps -q`" ] && $(DOCKER) stop `$(DOCKER) ps -q`
25 -$(DOCKER) rm `$(DOCKER) ps -a |grep -e arvados -e api_server -e keep_server -e doc_server -e workbench_server |cut -f 1 -d' '`
26 -$(DOCKER) rmi `$(DOCKER) images -q arvados/*`
28 # ============================================================
29 # Dependencies for */generated files which are prerequisites
30 # for building docker images.
32 CONFIG_RB = build_tools/config.rb
34 BUILD = build/.buildstamp
36 BASE_DEPS = base/Dockerfile $(BASE_GENERATED)
38 SLURM_DEPS = slurm/Dockerfile $(SLURM_GENERATED)
40 JOBS_DEPS = jobs/Dockerfile
42 JAVA_BWA_SAMTOOLS_DEPS = java-bwa-samtools/Dockerfile
44 API_DEPS = api/* $(API_GENERATED)
46 SHELL_DEPS = shell/* $(SHELL_GENERATED)
48 COMPUTE_DEPS = compute/* $(COMPUTE_GENERATED)
50 DOC_DEPS = doc/Dockerfile doc/apache2_vhost
52 WORKBENCH_DEPS = workbench/Dockerfile \
53 $(WORKBENCH_GENERATED)
55 KEEP_DEPS = keep/Dockerfile
57 SSO_DEPS = $(SSO_GENERATED)
59 BCBIO_NEXTGEN_DEPS = bcbio-nextgen/Dockerfile
61 BASE_GENERATED = base/generated/arvados.tar.gz
63 SLURM_GENERATED = slurm/generated/*
65 COMPUTE_GENERATED = compute/generated/setup.sh
67 COMPUTE_GENERATED_IN = compute/setup.sh.in
70 api/generated/arvados-clients.yml \
71 api/generated/apache2_vhost \
72 api/generated/config_databases.sh \
73 api/generated/database.yml \
74 api/generated/omniauth.rb \
75 api/generated/application.yml \
76 api/generated/setup.sh \
77 api/generated/setup-gitolite.sh \
78 api/generated/slurm.conf \
79 api/generated/superuser_token
82 api/arvados-clients.yml.in \
83 api/apache2_vhost.in \
84 api/config_databases.sh.in \
87 api/application.yml.in \
89 api/setup-gitolite.sh.in \
91 api/superuser_token.in
94 shell/generated/setup.sh \
95 shell/generated/superuser_token
97 SHELL_GENERATED_IN = \
99 shell/superuser_token.in
102 slurm/generated/slurm.conf
104 SLURM_GENERATED_IN = \
107 WORKBENCH_GENERATED = \
108 workbench/generated/apache2_vhost \
109 workbench/generated/application.yml
111 WORKBENCH_GENERATED_IN = \
112 workbench/apache2_vhost.in \
113 workbench/application.yml.in
116 sso/generated/apache2_vhost \
117 sso/generated/seeds.rb \
118 sso/generated/secret_token.rb
121 sso/apache2_vhost.in \
123 sso/secret_token.rb.in
127 rsync -rlp --exclude=docker/ --exclude='**/log/*' --exclude='**/tmp/*' \
128 --chmod=Da+rx,Fa+rX ../ build/
129 find build/ -name \*.gem -delete
130 cd build/services/fuse/ && python setup.py build
131 cd build/sdk/python/ && python setup.py build
132 cd build/sdk/cli && gem build arvados-cli.gemspec
133 cd build/sdk/ruby && gem build arvados.gemspec
134 touch build/.buildstamp
136 $(SLURM_GENERATED): config.yml $(BUILD)
138 mkdir -p slurm/generated
140 $(BASE_GENERATED): config.yml $(BUILD)
142 mkdir -p base/generated
143 tar -czf base/generated/arvados.tar.gz -C build .
145 $(API_GENERATED): config.yml $(API_GENERATED_IN)
148 $(SHELL_GENERATED): config.yml $(SHELL_GENERATED_IN)
151 $(WORKBENCH_GENERATED): config.yml $(WORKBENCH_GENERATED_IN)
154 $(COMPUTE_GENERATED): config.yml $(COMPUTE_GENERATED_IN)
156 $(WAREHOUSE_GENERATED): config.yml $(WAREHOUSE_GENERATED_IN)
159 $(SSO_GENERATED): config.yml $(SSO_GENERATED_IN)
162 # The docker build -q option suppresses verbose build output.
163 # Necessary to prevent failure on building warehouse; see
164 # https://github.com/dotcloud/docker/issues/3172
165 DOCKER_BUILD = $(DOCKER) build -q --rm=true
167 # ============================================================
168 # The main Arvados servers: api, doc, workbench, warehouse
170 api-image: passenger-image $(BUILD) $(API_DEPS)
171 @echo "Building api-image"
172 mkdir -p api/generated
173 tar -czf api/generated/api.tar.gz -C build/services api
174 chmod 755 api/generated/setup.sh
175 chmod 755 api/generated/setup-gitolite.sh
176 $(DOCKER_BUILD) -t arvados/api api
179 shell-image: base-image $(BUILD) $(SHELL_DEPS)
180 mkdir -p shell/generated
181 chmod 755 shell/generated/setup.sh
182 $(DOCKER_BUILD) -t arvados/shell shell
185 compute-image: slurm-image $(BUILD) $(COMPUTE_DEPS)
186 chmod 755 compute/generated/setup.sh
187 $(DOCKER_BUILD) -t arvados/compute compute
190 doc-image: base-image $(BUILD) $(DOC_DEPS)
191 mkdir -p doc/generated
192 tar -czf doc/generated/doc.tar.gz -C build doc
193 $(DOCKER_BUILD) -t arvados/doc doc
196 keep-image: debian-arvados-image $(BUILD) $(KEEP_DEPS)
197 $(DOCKER_BUILD) -t arvados/keep keep
200 jobs-image: base-image $(BUILD) $(JOBS_DEPS)
201 $(DOCKER_BUILD) -t arvados/jobs jobs
204 java-bwa-samtools-image: jobs-image $(BUILD) $(JAVA_BWA_SAMTOOLS_DEPS)
205 $(DOCKER_BUILD) -t arvados/jobs-java-bwa-samtools java-bwa-samtools
206 date >java-bwa-samtools-image
208 bcbio-nextgen-image: $(BUILD) $(BASE_GENERATED) $(BCBIO_NEXTGEN_DEPS)
209 rm -rf bcbio-nextgen/generated
210 cp -r base/generated bcbio-nextgen
211 $(DOCKER_BUILD) -t arvados/bcbio-nextgen bcbio-nextgen
212 date >bcbio-nextgen-image
214 workbench-image: passenger-image $(BUILD) $(WORKBENCH_DEPS)
215 mkdir -p workbench/generated
216 tar -czf workbench/generated/workbench.tar.gz -C build/apps workbench
217 $(DOCKER_BUILD) -t arvados/workbench workbench
218 date >workbench-image
220 warehouse-image: base-image $(WAREHOUSE_DEPS)
221 $(DOCKER_BUILD) -t arvados/warehouse warehouse
222 date >warehouse-image
224 sso-image: passenger-image $(SSO_DEPS)
225 $(DOCKER_BUILD) -t arvados/sso sso
228 # ============================================================
229 # The arvados/base image is the base Debian image plus packages
230 # that are dependencies for every Arvados service.
232 passenger-image: base-image
233 $(DOCKER_BUILD) -t arvados/passenger passenger
234 date >passenger-image
236 slurm-image: base-image $(SLURM_DEPS)
237 $(DOCKER_BUILD) -t arvados/slurm slurm
240 base-image: debian-arvados-image $(BASE_DEPS)
241 @echo "Building base-image"
242 $(DOCKER_BUILD) -t arvados/base base
245 debian-arvados-image:
246 ./mkimage-debootstrap.sh arvados/debian wheezy ftp://ftp.us.debian.org/debian/
247 date >debian-arvados-image