12
Dockerfile
12
Dockerfile
@ -9,20 +9,24 @@ RUN apt-get update -qq && \
|
|||||||
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
|
||||||
|
# After setting WORKDIR and USER app
|
||||||
WORKDIR $HOME/wedding
|
WORKDIR $HOME/wedding
|
||||||
USER app
|
USER app
|
||||||
|
|
||||||
# Copy only Gemfiles first for caching
|
# Copy Gemfiles and install Ruby deps
|
||||||
COPY --chown=app:app Gemfile Gemfile.lock ./
|
COPY --chown=app:app Gemfile Gemfile.lock ./
|
||||||
RUN bundle install
|
RUN bundle install
|
||||||
|
|
||||||
# Copy the rest of the app
|
# Copy the rest of the app
|
||||||
COPY --chown=app:app . ./
|
COPY --chown=app:app . ./
|
||||||
|
|
||||||
# Run bundle again in case new gems are required (because of conditional Gemfile logic)
|
# Ensure node_modules directory is owned by app
|
||||||
RUN bundle install
|
RUN mkdir -p node_modules && chmod -R 755 node_modules
|
||||||
|
|
||||||
# Compile assets (SCSS -> CSS)
|
# Install JS deps before assets:precompile
|
||||||
|
RUN yarn install --check-files
|
||||||
|
|
||||||
|
# Compile assets
|
||||||
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"]
|
||||||
|
Reference in New Issue
Block a user