FROM ruby:3.0-slim as cache RUN apt-get update -qq && apt-get install -y \ curl \ build-essential \ libpq-dev \ postgresql-client RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - RUN curl -sL 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 RUN apt-get update -qq && apt-get install -y yarn WORKDIR /bookstore COPY Gemfile /<%= app_name %>/Gemfile COPY Gemfile.lock /<%= app_name %>/Gemfile.lock COPY package.json /<%= app_name %>/package.json COPY yarn.lock /<%= app_name %>/yarn.lock RUN bundle install --without development RUN yarn install FROM cache COPY . /bookstore ARG DATABASE_HOST=db ARG RAILS_ENV=production ENV DATABASE_HOST=$DATABASE_HOST ENV RAILS_ENV=$RAILS_ENV ENV RAILS_LOG_TO_STDOUT=true ENV RAILS_SERVE_STATIC_FILES=true RUN bundle exec rails assets:precompile COPY entrypoint.sh /usr/bin/ RUN chmod +x /usr/bin/entrypoint.sh ENTRYPOINT ["entrypoint.sh"] EXPOSE 3000 # Start the main process. CMD ["rails", "server", "-b", "0.0.0.0"]