Updated Makefile for more accurate dependency management.
[arvados.git] / docker / Makefile
1 all: api-image docserver-image workbench-image warehouse-image
2
3 # ============================================================
4 # The main Arvados servers: api, docserver, workbench, warehouse
5
6 api-image: base-image $(API_DEPS)
7         tar -c -z -f api/generated/api.tar.gz -C ../services api
8         docker build -t arvados/api api
9         echo -n "Built at $(date)" > api-image
10
11 docserver-image: base-image $(DOCSERVER_DEPS) 
12         tar -c -z -f docserver/generated/doc.tar.gz -C .. doc
13         docker build -t arvados/docserver docserver
14         echo -n "Built at $(date)" > docserver-image
15
16 workbench-image: base-image $(WORKBENCH_DEPS)
17         tar -c -z -f workbench/generated/workbench.tar.gz -C ../apps workbench
18         docker build -t arvados/workbench workbench
19         echo -n "Built at $(date)" > workbench-image
20
21 warehouse-image: base-image $(WAREHOUSE_DEPS)
22         tar -c -z -f warehouse/generated/warehouse.tar.gz -C ../.. warehouse-apps
23         docker build -t arvados/warehouse warehouse
24         echo -n "Built at $(date)" > warehouse-image
25
26 # ============================================================
27 # The arvados/base image is the base Debian image plus packages
28 # that are dependencies for every Arvados service.
29
30 base-image: debian-image
31         docker build -t arvados/base base
32         echo -n "Built at $(date)" > base-image
33
34 debian-image:
35         ./mkimage-debootstrap.sh arvados/debian wheezy http://debian.lcs.mit.edu/debian/
36         echo -n "Built at $(date)" > debian-image
37
38 # ============================================================
39 # Dependencies for */generated files which are prerequisites
40 # for building docker images.
41
42 API_DEPS = api/Dockerfile $(API_GENERATED)
43
44 DOCSERVER_DEPS = docserver/Dockerfile docserver/apache2_vhost
45
46 WORKBENCH_DEPS = workbench/Dockerfile \
47                  workbench/passenger.conf \
48                  $(WORKBENCH_GENERATED)
49
50 WAREHOUSE_DEPS = warehouse/Dockerfile \
51                  warehouse/supervisor.conf \
52                  $(WAREHOUSE_GENERATED)
53
54 API_GENERATED = \
55         api/generated/apache2_vhost \
56         api/generated/config_databases.sh \
57         api/generated/database.yml \
58         api/generated/omniauth.rb \
59         api/generated/production.rb \
60         api/generated/secret_token.rb
61
62 API_GENERATED_IN = \
63         api/apache2_vhost.in \
64         api/config_databases.sh.in \
65         api/database.yml.in \
66         api/omniauth.rb.in \
67         api/production.rb.in \
68         api/secret_token.rb.in
69
70 WORKBENCH_GENERATED = \
71         workbench/generated/apache_vhost \
72         workbench/generated/production.rb \
73         workbench/generated/secret_token.rb
74
75 WORKBENCH_GENERATED_IN = \
76         workbench/apache_vhost.in \
77         workbench/production.rb.in \
78         workbench/secret_token.rb.in
79
80 WAREHOUSE_GENERATED = warehouse/generated/warehouse.conf
81
82 WAREHOUSE_GENERATED_IN = warehouse/warehouse.conf.in
83
84 $(API_GENERATED): $(API_GENERATED_IN)
85         ./config.rb
86
87 $(WORKBENCH_GENERATED): $(WORKBENCH_GENERATED_IN)
88         ./config.rb
89
90 $(WAREHOUSE_GENERATED): $(WAREHOUSE_GENERATED_IN)
91         ./config.rb