mirror of
https://github.com/chenasraf/opensnp.org-docker.git
synced 2026-05-18 01:49:07 +00:00
* Use docker-compose to run database setup * Build sidekiq image in test script * Fix db migration startup script * Let Runit deal with services Sidekiq was started by a blocking script in my_init. This lead to the init process not getting to run Runit, which is in charge of CRON among other things. To fix it, I moved Sidekiq to be run by Runit as well. I also moved the postfix start script, while I was at it.
54 lines
1.8 KiB
Docker
54 lines
1.8 KiB
Docker
FROM phusion/passenger-customizable:2.3.1
|
|
|
|
ENV RAILS_ENV production
|
|
|
|
RUN apt-get -q update
|
|
RUN apt-get -qy -o Dpkg::Options::="--force-confold" upgrade
|
|
RUN echo 'postfix postfix/mailname string opensnp.org' | debconf-set-selections
|
|
RUN echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
|
|
RUN apt-get install -qy libhiredis-dev postgresql-client postfix imagemagick tzdata libpq-dev certbot shared-mime-info python3-certbot-nginx
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
RUN postconf -e myhostname=opensnp.org
|
|
COPY postfix /etc/service/postfix/run
|
|
|
|
COPY nginx /etc/nginx
|
|
RUN sed -i "s/# gzip_types/gzip_types/" /etc/nginx/nginx.conf
|
|
RUN sed -i "s/# gzip_vary/gzip_vary/" /etc/nginx/nginx.conf
|
|
RUN sed -i "s/# gzip_proxied/gzip_proxied/" /etc/nginx/nginx.conf
|
|
RUN sed -i "s/# gzip_http/gzip_http/" /etc/nginx/nginx.conf
|
|
|
|
RUN rm /etc/nginx/sites-enabled/default
|
|
RUN rm -f /etc/service/nginx/down
|
|
|
|
COPY renew_ssl_cert.cron /etc/cron.d/renew_ssl_cert
|
|
COPY db_migrate.sh /etc/my_init.d/90_db_migrate.sh
|
|
|
|
# If SNPR_REV changed, re-evaluate from here.
|
|
ARG SNPR_REV
|
|
|
|
RUN git clone --depth=1 https://github.com/openSNP/snpr.git /home/app/snpr
|
|
WORKDIR /home/app/snpr
|
|
RUN git rev-parse HEAD > REVISION
|
|
RUN rm -rf .git
|
|
RUN chown app:app -R /home/app
|
|
|
|
RUN /usr/local/rvm/bin/rvm install $(cat .ruby-version)
|
|
RUN /usr/local/rvm/bin/rvm alias create default $(cat .ruby-version)
|
|
|
|
USER app
|
|
|
|
COPY irbrc /home/app/.irbrc
|
|
COPY database.yml config/database.yml
|
|
RUN bash -l -c 'gem install bundler'
|
|
RUN bash -l -c 'bundle install --jobs=4 --deployment --without test development'
|
|
RUN cp .env.development .env
|
|
RUN bash -l -c 'bundle exec rake assets:precompile'
|
|
RUN rm .env
|
|
|
|
USER root
|
|
|
|
RUN bin/extract_env_var_names_for_nginx > /etc/nginx/main.d/rails-env.conf
|
|
|
|
CMD ["/sbin/my_init"]
|