24
Dockerfile
24
Dockerfile
@ -1,20 +1,28 @@
|
|||||||
FROM ruby:2.7.8
|
FROM ruby:2.7.8
|
||||||
|
|
||||||
# Point to Debian archive repos instead of the dead ones
|
|
||||||
|
|
||||||
RUN apt-get update -qq && \
|
RUN apt-get update -qq && \
|
||||||
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
|
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
|
||||||
apt-get install -y build-essential libpq-dev nodejs && \
|
apt-get install -y build-essential libpq-dev nodejs curl gnupg && \
|
||||||
|
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 -qq && apt-get install -y yarn && \
|
||||||
useradd --user-group --create-home --shell /bin/false app
|
useradd --user-group --create-home --shell /bin/false app
|
||||||
|
|
||||||
ENV HOME=/home/app
|
ENV HOME=/home/app
|
||||||
|
WORKDIR $HOME/wedding
|
||||||
USER app
|
USER app
|
||||||
|
|
||||||
COPY --chown=app:app Gemfile Gemfile.lock $HOME/wedding/
|
# Copy only Gemfiles first for caching
|
||||||
WORKDIR $HOME/wedding
|
COPY --chown=app:app Gemfile Gemfile.lock ./
|
||||||
|
RUN bundle install
|
||||||
|
|
||||||
|
# Copy the rest of the app
|
||||||
|
COPY --chown=app:app . ./
|
||||||
|
|
||||||
|
# Run bundle again in case new gems are required (because of conditional Gemfile logic)
|
||||||
|
RUN bundle install
|
||||||
|
|
||||||
|
# Compile assets (SCSS -> CSS)
|
||||||
RUN bundle exec rake assets:precompile
|
RUN bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
|
||||||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
|
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
|
||||||
|
|
||||||
COPY --chown=app:app . $HOME/wedding/
|
|
||||||
|
Reference in New Issue
Block a user