12
Dockerfile
12
Dockerfile
@ -9,20 +9,24 @@ RUN apt-get update -qq && \
|
||||
useradd --user-group --create-home --shell /bin/false app
|
||||
|
||||
ENV HOME=/home/app
|
||||
# After setting WORKDIR and USER app
|
||||
WORKDIR $HOME/wedding
|
||||
USER app
|
||||
|
||||
# Copy only Gemfiles first for caching
|
||||
# Copy Gemfiles and install Ruby deps
|
||||
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
|
||||
# Ensure node_modules directory is owned by app
|
||||
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
|
||||
|
||||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
|
||||
|
Reference in New Issue
Block a user