forked from vilanovailageltru/decidim-vilanova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.production
59 lines (42 loc) · 1.43 KB
/
Dockerfile.production
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
54
55
56
57
58
59
FROM phusion/passenger-ruby25:0.9.35
MAINTAINER MarsBased "hola@marsbased.com"
ENV HOME /home/app/decidim-vilanova
# Install software dependencies
RUN apt-get update
RUN apt-get install -y imagemagick gettext-base tzdata
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Expose Nginx HTTP service
EXPOSE 80
EXPOSE 443
# Start Nginx / Passenger
RUN rm -f /etc/service/nginx/down
# Remove the default site
RUN rm /etc/nginx/sites-enabled/default
# Create app home dir
RUN mkdir -p $HOME
WORKDIR $HOME
# Install bundle of gems
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN bundle install --without development test
# Add the nginx site and config
ADD docker/nginx.conf /etc/nginx/sites-enabled/decidim-vilanova.conf
ADD docker/rails-env.conf /etc/nginx/main.d/rails-env.conf
# Add the Rails app
ADD . /home/app/decidim-vilanova
RUN RAILS_ENV=production SECRET_KEY_BASE=NOT-IMPORTANT bin/rake assets:precompile
# Add a tmp folder for pids
RUN mkdir -p tmp/pids
# Define volumes
VOLUME $HOME/public/uploads
VOLUME $HOME/log
# Configure init scripts
RUN mkdir -p /etc/my_init.d
ADD docker/fix_permissions.sh /etc/my_init.d/fix_permissions.sh
ADD docker/replace_nginx_variables.sh /etc/my_init.d/replace_nginx_variables.sh
ADD docker/sidekiq.sh /etc/my_init.d/sidekiq.sh
RUN chmod +x /etc/my_init.d/*.sh
RUN chown -R app:app $HOME
# Clean up APT and bundler when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*.