PaaS is ingenious idea, and sufficient for 90% use cases, so I never expect myself to deploy without it. However, things rarely go according to plan; the Rails project we are building requires FS access, but Heroku use ephemeral FS, which more or less is read-only FS. Therefore, we need to deploy it in our own server.

Docker seems the most popular choice currently, and I uses it for my personal development, so it’s reasonable to use it in production as well. One detail distinguishing this implementation from others, is that we would update the product rapidly, so the source code is not embedded into the Docker image. Instead, the code repo is shared between host and Docker OS. In other words, Docker merely provides the running infrastructure for Rails.

The final Dockerfile is online, and hope it’s helpful to someone else.

Reference

Dockerfile: Provides one example on using Rails with Docker.