-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.production
72 lines (52 loc) · 1.82 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
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM phusion/passenger-full:2.1.0
MAINTAINER Codegram "[email protected]"
ENV HOME /home/app/decidim-vilanova
# Install software dependencies
RUN mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak
RUN apt update && apt install -y ca-certificates
RUN mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d
RUN apt-get update; exit 0
RUN apt-get --allow-releaseinfo-change update
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
RUN bash -lc 'rvm install ruby-3.1.4'
RUN bash -lc 'rvm --default use ruby-3.1.4'
RUN gem install bundler -v 2.4.10
# 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 bash -lc 'npm install'
RUN bash -lc 'npm install --global yarn'
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/storage
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
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/*.