mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
Update Dockerfile for production
This commit is contained in:
parent
6c3c9e7770
commit
f2fd71bd9a
1 changed files with 19 additions and 20 deletions
39
Dockerfile
39
Dockerfile
|
@ -1,38 +1,37 @@
|
|||
FROM ruby:2.2
|
||||
FROM ruby:2.4.9
|
||||
|
||||
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
|
||||
RUN service memcached start
|
||||
RUN apt-get update && apt-get -y upgrade \
|
||||
&& apt-get -y install \
|
||||
libmariadb-dev libmariadb-dev-compat \
|
||||
libssl-dev \
|
||||
zlib1g-dev libreadline-dev libyaml-dev \
|
||||
libxslt1-dev libxml2-dev \
|
||||
imagemagick libmagickwand-dev \
|
||||
nodejs \
|
||||
firefox-esr
|
||||
|
||||
# Separate Gemfile ADD so that `bundle install` can be cached more effectively
|
||||
ADD Gemfile Gemfile.lock /var/www/
|
||||
|
||||
ADD Gemfile /var/www/
|
||||
ADD Gemfile.lock /var/www/
|
||||
RUN chown -R web:web /var/www &&\
|
||||
mkdir -p /var/bundle &&\
|
||||
chown -R web:web /var/bundle
|
||||
|
||||
RUN su -c "bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4" -s /bin/bash -l web
|
||||
|
||||
# Add application source
|
||||
ADD . /var/www
|
||||
RUN chown -R web:web /var/www
|
||||
RUN gem install bundler && \
|
||||
mkdir -p /var/bundle && chown -R web:web /var/bundle && chown -R web:web /var/www
|
||||
|
||||
WORKDIR /var/www
|
||||
USER web
|
||||
|
||||
RUN mkdir -p /var/www/log && touch /var/www/log/${RAILS_ENV}.log
|
||||
RUN bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4
|
||||
RUN bundle exec rake assets:precompile
|
||||
|
||||
# This is a temporary solution to fix assets issue
|
||||
RUN bundle config github.https true && \
|
||||
bundle config set path '/var/bundle' && \
|
||||
bundle install --jobs 8 && \
|
||||
bundle exec rake assets:precompile
|
||||
|
||||
USER root
|
||||
|
||||
# Temporary fix for assets
|
||||
RUN mv /var/www/public/assets /home/web/assets
|
||||
|
||||
CMD ["/var/www/script/entry.sh"]
|
||||
|
|
Loading…
Reference in a new issue