2018-04-10 01:08:38 +00:00
|
|
|
FROM ruby:2.2
|
|
|
|
|
|
|
|
ENV RAILS_ENV production
|
|
|
|
|
|
|
|
# Add 'web' user which will run the application
|
|
|
|
RUN adduser web --home /home/web --shell /bin/bash --disabled-password --gecos ""
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get -y upgrade
|
|
|
|
RUN apt-get -y install mysql-client libmysqlclient-dev memcached nodejs
|
2018-04-15 12:59:57 +00:00
|
|
|
RUN service memcached start
|
2018-04-10 01:08:38 +00:00
|
|
|
|
|
|
|
# Separate Gemfile ADD so that `bundle install` can be cached more effectively
|
|
|
|
|
|
|
|
ADD Gemfile /var/www/
|
|
|
|
ADD Gemfile.lock /var/www/
|
|
|
|
RUN chown -R web:web /var/www &&\
|
2019-11-27 16:57:52 +00:00
|
|
|
mkdir -p /var/bundle &&\
|
|
|
|
chown -R web:web /var/bundle
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2018-04-15 12:59:57 +00:00
|
|
|
RUN su -c "bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4" -s /bin/bash -l web
|
2018-04-10 01:08:38 +00:00
|
|
|
|
|
|
|
# Add application source
|
|
|
|
ADD . /var/www
|
|
|
|
RUN chown -R web:web /var/www
|
|
|
|
|
2018-04-23 15:29:07 +00:00
|
|
|
WORKDIR /var/www
|
|
|
|
USER web
|
2018-04-25 16:41:22 +00:00
|
|
|
|
2019-11-27 16:57:52 +00:00
|
|
|
RUN touch log/${RAILS_ENV}.log
|
2018-04-23 15:29:07 +00:00
|
|
|
RUN bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4
|
2018-04-25 16:41:22 +00:00
|
|
|
RUN bundle exec rake assets:precompile
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2018-04-25 16:41:22 +00:00
|
|
|
# This is a temporary solution to fix assets issue
|
2018-04-14 13:02:58 +00:00
|
|
|
|
2018-04-25 16:41:22 +00:00
|
|
|
USER root
|
2019-10-09 19:04:09 +00:00
|
|
|
RUN mv /var/www/public/assets /home/web/assets
|
|
|
|
|
2018-04-25 16:41:22 +00:00
|
|
|
CMD ["/var/www/script/entry.sh"]
|