forked from quran/quran.com-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (43 loc) · 1.43 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
54
55
56
FROM phusion/passenger-customizable:0.9.17
# set correct environment variables
ENV HOME /root
# use baseimage-docker's init process
CMD ["/sbin/my_init"]
# customizing passenger-customizable image
RUN /pd_build/ruby2.2.sh
RUN /pd_build/redis.sh
ENV RAILS_ENV production
# native passenger
RUN ruby2.2 -S passenger-config build-native-support
RUN setuser app ruby2.2 -S passenger-config build-native-support
# nginx
RUN rm /etc/service/nginx/down
RUN rm /etc/nginx/sites-enabled/default
ADD docker/backend.quran.com /etc/nginx/sites-enabled/backend.quran.com
ADD docker/postgres-env.conf /etc/nginx/main.d/postgres-env.conf
ADD docker/elasticsearch-env.conf /etc/nginx/main.d/elasticsearch-env.conf
ADD docker/gzip.conf /etc/nginx/conf.d/gzip.conf
# logrotate
COPY docker/nginx.logrotate.conf /etc/logrotate.d/nginx
RUN cp /etc/cron.daily/logrotate /etc/cron.hourly
# redis
RUN rm /etc/service/redis/down
RUN sed -i 's/^\(stop-writes-on-bgsave-error .*\)$/stop-writes-on-bgsave-error no/' /etc/redis/redis.conf && \
echo vm.overcommit_memory = 1 >> /etc/sysctl.conf
# setup gems
WORKDIR /tmp
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN bundle install
# setup the app
RUN mkdir /home/app/quran
ADD . /home/app/quran/
WORKDIR /home/app/quran
RUN chown -R app log
RUN chown -R app public
RUN chown app Gemfile
RUN chown app Gemfile.lock
# cleanup apt
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# expose port 3000
EXPOSE 3000