backend_v2/Dockerfile
ARG RUBY_VERSION FROM ruby:$RUBY_VERSION-slim as base # Rails app lives hereWORKDIR /app # Throw-away build stage to reduce size of final imageFROM base as build # Install packages needed to build gemsRUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config # RUN apt-get update -qq && apt-get install -y postgresql-client # Install application gemsCOPY Gemfile Gemfile.lock ./RUN bundle install && \ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ bundle exec bootsnap precompile --gemfile # Copy application codeCOPY . . # Precompile bootsnap code for faster boot timesRUN bundle exec bootsnap precompile app/ lib/ # Final stage for app imageFROM base # Install packages needed for deploymentRUN apt-get update -qq && \ apt-get install --no-install-recommends -y curl libvips postgresql-client netcat-traditional && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, applicationCOPY --from=build /usr/local/bundle /usr/local/bundleCOPY --from=build /app /app # Start the server by default, this can be overwritten at runtimeEXPOSE 3000CMD ["sh", "/app/entrypoint.sh"]