Add production configuration
ryanwi opened this issue · comments
This repo is currently focused on getting a local development environment up and running and is not fully ready for production deployment.
Options to consider:
- separate production dockerfile
- maintain single dockerfile and add bundling
- create multi-stage single dockerfile
- incorporate docker-compose.yml into the mix too
any updates? It would be nice to see any notes on how this can be used to deploy on standalone production server
A nice production/deployment dockerfile is autogenerated when you use fly.io or https://github.com/rubys/dockerfile-rails
the idea is to use multi-stage dockerfile with base and build layer, where build is only used for installing dependencies (e.g. it'll contain all postgresql or mysql -dev packages along with other libXXX-dev stuff that is only required to install gems with native extensions) and is discarded after gems are installed. I'm just thinking that dockerfile-rails already provides this
FROM ruby:$RUBY_VERSION-slim as base
# gem update, install nodejs
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build gems and node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential libpq-dev git ...
# yarn install
# bootsnap precompile
# assets precompile
# Final stage for app image
FROM base
RUN apt-get -y install postgresql-client ...
# and so on
Yes, exactly, thanks for the info.