2022-05-14 16:21:37 +00:00
|
|
|
FROM ruby:2.6.10 AS ensl_development
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2020-04-05 02:58:41 +00:00
|
|
|
ENV RAILS_ENV development
|
2020-04-08 19:25:24 +00:00
|
|
|
ENV APP_PATH /var/www
|
2020-04-11 13:40:38 +00:00
|
|
|
ENV WEB_UID 1000
|
|
|
|
ENV WEB_GID 1000
|
2020-04-06 00:31:05 +00:00
|
|
|
|
|
|
|
RUN \
|
|
|
|
# Add web
|
2020-04-11 13:40:38 +00:00
|
|
|
adduser web --uid $WEB_UID --home /home/web --shell /bin/bash --disabled-password --gecos "" && \
|
2020-04-06 00:31:05 +00:00
|
|
|
apt-get update && apt-get -y upgrade && \
|
|
|
|
# Pre-dependencies
|
|
|
|
apt-get -y install curl && \
|
|
|
|
# Yarn repo
|
|
|
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
|
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
|
|
|
|
# Dependencies
|
2020-04-08 19:25:24 +00:00
|
|
|
apt-get -y install --upgrade \
|
2020-04-06 00:31:05 +00:00
|
|
|
# For MySQL/MariaDB
|
|
|
|
libmariadb-dev libmariadb-dev-compat \
|
|
|
|
# SSL libs
|
|
|
|
libssl-dev \
|
|
|
|
# zlib, readline and libyaml
|
|
|
|
zlib1g-dev libreadline-dev libyaml-dev \
|
|
|
|
# For nogokiri
|
|
|
|
libxslt1-dev libxml2-dev \
|
|
|
|
# For carrierwave/rmagick
|
|
|
|
imagemagick libmagickwand-dev \
|
|
|
|
# For javascript gems
|
|
|
|
nodejs \
|
|
|
|
# For assets pipeline
|
|
|
|
yarn \
|
|
|
|
# For poltergeist
|
2022-05-14 16:21:37 +00:00
|
|
|
# phantomjs \
|
2020-04-08 19:25:24 +00:00
|
|
|
firefox-esr && \
|
|
|
|
# Install bundler and bundle path
|
|
|
|
gem install bundler && \
|
|
|
|
mkdir -p /var/bundle && chown -R web:web /var/bundle
|
2020-04-11 13:40:38 +00:00
|
|
|
# Clean up
|
|
|
|
# apt-get --purge autoremove && rm -rf /var/apt/lists/*
|
2018-04-10 01:08:38 +00:00
|
|
|
|
|
|
|
# Separate Gemfile ADD so that `bundle install` can be cached more effectively
|
2020-04-08 19:25:24 +00:00
|
|
|
ADD --chown=web Gemfile Gemfile.lock /var/www/
|
2018-04-10 01:08:38 +00:00
|
|
|
|
2018-04-23 15:29:07 +00:00
|
|
|
USER web
|
2020-04-06 00:31:05 +00:00
|
|
|
WORKDIR /var/www
|
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
|
|
|
|
|
2020-04-06 00:31:05 +00:00
|
|
|
#
|
2020-04-05 02:58:41 +00:00
|
|
|
# Production
|
2020-04-06 00:31:05 +00:00
|
|
|
#
|
2020-04-05 02:58:41 +00:00
|
|
|
|
|
|
|
FROM ensl_development AS ensl_production
|
|
|
|
|
|
|
|
ENV RAILS_ENV production
|
|
|
|
|
2020-04-06 00:31:05 +00:00
|
|
|
ADD --chown=web . /var/www
|
2020-04-05 02:58:41 +00:00
|
|
|
|
2020-04-06 00:31:05 +00:00
|
|
|
# USER root
|
|
|
|
# RUN chown -R web:web /var/www
|
|
|
|
# USER web
|
2020-04-05 02:58:41 +00:00
|
|
|
|
2020-04-06 00:31:05 +00:00
|
|
|
# Assets are only compiled for production+
|
2020-04-05 02:58:41 +00:00
|
|
|
RUN bundle exec rake assets:precompile && \
|
2020-04-06 00:31:05 +00:00
|
|
|
# FIXME: Temporary fix for assets
|
|
|
|
# Move assets to a temp dir here and move them back in entry script
|
|
|
|
cp -r /var/www/public/assets /home/web/assets
|
|
|
|
|
|
|
|
#
|
|
|
|
# Staging
|
|
|
|
#
|
|
|
|
|
|
|
|
FROM ensl_production AS ensl_staging
|
|
|
|
|
|
|
|
ENV RAILS_ENV staging
|
2019-10-09 19:04:09 +00:00
|
|
|
|
2020-04-06 00:31:05 +00:00
|
|
|
# ENTRYPOINT ["/bin/bash"]
|
|
|
|
# CMD ["/var/www/bin/script/entry.sh"]
|