forked from autolab/Autolab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (42 loc) · 1.35 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Dockerfile from
#
# https://intercityup.com/blog/how-i-build-a-docker-image-for-my-rails-app.html
#
# See more documentation at the passenger-docker GitHub repo:
#
# https://github.com/phusion/passenger-docker
#
#
FROM phusion/passenger-ruby22:0.9.15
MAINTAINER Autolab Development Team "[email protected]"
# Set correct environment variables.
ENV HOME /root
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Start Nginx / Passenger
RUN rm -f /etc/service/nginx/down
# Remove the default site
RUN rm /etc/nginx/sites-enabled/default
# Add the nginx info
ADD docker/nginx.conf /etc/nginx/sites-enabled/webapp.conf
# Prepare folders
RUN mkdir /home/app/webapp
# Run Bundle in a cache efficient way
WORKDIR /tmp
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN bundle install
# Add the rails app
ADD . /home/app/webapp
# Move the database configuration into place
ADD config/database.docker.yml /home/app/webapp/config/database.yml
# Create the log files
RUN mkdir -p /home/app/webapp/log && \
touch /home/app/webapp/log/production.log && \
chown -R app:app /home/app/webapp/log && \
chmod 0664 /home/app/webapp/log/production.log
# precompile the Rails assets
WORKDIR /home/app/webapp
RUN RAILS_ENV=production bundle exec rake assets:precompile
# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*