Merge branch '1646-arv-put'
[arvados.git] / docker / api / Dockerfile
1 # Arvados API server Docker container.
2
3 FROM arvados/passenger
4 MAINTAINER Tim Pierce <twp@clinicalfuture.com>
5
6 # Install postgres and apache
7 RUN apt-get -q -y install procps postgresql postgresql-server-dev-9.1 apache2 \
8                           supervisor
9
10 RUN /bin/mkdir -p /usr/src/arvados/services
11 ADD generated/api.tar.gz /usr/src/arvados/services/
12
13 # Install generated config files
14 ADD generated/database.yml /usr/src/arvados/services/api/config/database.yml
15 ADD generated/secret_token.rb /usr/src/arvados/services/api/config/initializers/secret_token.rb
16 ADD generated/omniauth.rb /usr/src/arvados/services/api/config/initializers/omniauth.rb
17 ADD generated/production.rb /usr/src/arvados/services/api/config/environments/production.rb
18 ADD generated/apache2_vhost /etc/apache2/sites-available/arvados
19
20 # Configure Rails databases.
21 ENV RAILS_ENV production
22 ADD generated/config_databases.sh /tmp/config_databases.sh
23 ADD generated/superuser_token /tmp/superuser_token
24 RUN sh /tmp/config_databases.sh && \
25     rm /tmp/config_databases.sh && \
26     /etc/init.d/postgresql start && \
27     cd /usr/src/arvados/services/api && \
28     rake db:setup && \
29     rake assets:precompile && \
30     ./script/create_superuser_token.rb $(cat /tmp/superuser_token) && \
31     chown www-data:www-data config.ru && \
32     chown www-data:www-data log -R && \
33     chown www-data:www-data tmp -R
34
35 # Configure Apache and Passenger.
36 ADD passenger.conf /etc/apache2/conf.d/passenger
37 RUN a2dissite default ; \
38     a2ensite arvados ; \
39     a2enmod rewrite ; \
40     a2enmod ssl ; \
41     /bin/mkdir /var/run/apache2
42
43 # Supervisor.
44 ADD supervisor.conf /etc/supervisor/conf.d/arvados.conf
45 ADD apache2_foreground.sh /etc/apache2/foreground.sh
46
47 # Start the supervisor.
48 CMD ["/usr/bin/supervisord", "-n"]