2020-04-05 02:58:41 +00:00
|
|
|
FROM ruby:2.6.5 AS ensl_development
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2020-04-05 02:58:41 +00:00
|
|
|
ENV RAILS_ENV development
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2020-04-05 02:58:41 +00:00
|
|
|
RUN adduser web --home /home/web --shell /bin/bash --disabled-password --gecos "" && \
|
|
|
|
apt-get update && apt-get -y upgrade \
|
2020-03-17 01:36:46 +00:00
|
|
|
&& 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 \
|
2020-03-18 19:11:10 +00:00
|
|
|
phantomjs \
|
2020-03-17 01:36:46 +00:00
|
|
|
firefox-esr
|
2018-04-10 01:08:38 +00:00
|
|
|
|
|
|
|
# Separate Gemfile ADD so that `bundle install` can be cached more effectively
|
2020-03-17 01:36:46 +00:00
|
|
|
ADD Gemfile Gemfile.lock /var/www/
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2020-03-17 01:36:46 +00:00
|
|
|
RUN gem install bundler && \
|
2020-04-05 02:58:41 +00:00
|
|
|
mkdir -p /var/bundle && chown -R web:web /var/bundle && \
|
|
|
|
chown -R web:web /var/www
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2018-04-23 15:29:07 +00:00
|
|
|
WORKDIR /var/www
|
|
|
|
USER web
|
2018-04-25 16:41:22 +00:00
|
|
|
|
2020-03-17 01:36:46 +00:00
|
|
|
RUN bundle config github.https true && \
|
|
|
|
bundle config set path '/var/bundle' && \
|
2020-04-05 02:58:41 +00:00
|
|
|
bundle install --jobs 8
|
|
|
|
|
|
|
|
USER root
|
|
|
|
|
|
|
|
# ENTRYPOINT ["/bin/bash"]
|
|
|
|
# CMD ["/var/www/bin/script/entry.sh"]
|
|
|
|
|
|
|
|
# Staging
|
|
|
|
|
|
|
|
FROM ensl_development AS ensl_staging
|
|
|
|
|
|
|
|
ENV RAILS_ENV staging
|
2018-04-14 13:02:58 +00:00
|
|
|
|
2018-04-25 16:41:22 +00:00
|
|
|
USER root
|
2020-03-17 01:36:46 +00:00
|
|
|
|
2020-04-05 02:58:41 +00:00
|
|
|
ENTRYPOINT ["/bin/bash"]
|
|
|
|
CMD ["/var/www/bin/script/entry.sh"]
|
|
|
|
|
|
|
|
# Production
|
|
|
|
|
|
|
|
FROM ensl_development AS ensl_production
|
|
|
|
|
|
|
|
ENV RAILS_ENV production
|
|
|
|
|
|
|
|
ADD . /var/www
|
|
|
|
|
|
|
|
WORKDIR /var/www
|
|
|
|
|
|
|
|
RUN chown -R web:web /var/www
|
|
|
|
|
|
|
|
USER web
|
|
|
|
RUN bundle exec rake assets:precompile && \
|
|
|
|
# Temporary fix for assets
|
|
|
|
mv /var/www/public/assets /home/web/assets
|
2019-10-09 19:04:09 +00:00
|
|
|
|
2020-04-05 02:58:41 +00:00
|
|
|
ENTRYPOINT ["/bin/bash"]
|
2020-03-22 13:29:39 +00:00
|
|
|
CMD ["/var/www/bin/script/entry.sh"]
|