FROM <%= @root_image %>
# Install dependencies RUN apt-get update -qq \
&& apt-get install -y build-essential \ && apt-get install -y libxml2-dev libxslt1-dev \
<%- if postgres? -%>
&& apt-get install -y libpq-dev \
<%- end -%> <%- if frontend? -%>
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \ && 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 \ && apt-get update && apt-get install -y nodejs yarn \
<%- end -%>
&& apt-get clean
ENV RACK_ENV=production \ <%- if frontend? -%>
NODE_ENV=production \
<%- end -%>
RAILS_LOG_TO_STDOUT=true \ RAILS_ENV=production
RUN mkdir /<%= @app_home %> WORKDIR /<%= @app_home %>
# Install gems ADD Gemfile* /<%= @app_home %>/ RUN gem install bundler:2.1.4 \
&& bundle config set deployment 'true' \ && bundle config set without 'development' \ && bundle install
# Install application ADD . /<%= @app_home %>
# Perform post-installation tasks RUN bundle exec rake tmp:create \ <%- if frontend? -%>
&& bundle exec rake assets:precompile \ && bundle exec rake assets:clean \
<%- end -%>
&& bundle exec rake tmp:clear
# Start the application server EXPOSE 3000 CMD [“bin/web”]