Deploying a Ruby-on-Rails web application in Docker
The great thing with Docker is that, as developers, we can ship whatever is working on this particular container on one environment (such as development or staging) and be sure it will run similarly in another environment (such as production). Deploys are less stressful, and rollbacks are easier. However, to achieve this peace of mind, we need more than a Ruby-on-Rails application, for example, we need to ship a Dockerfile containing everything to build a self-sufficient container so anyone can run it. Here's how to do it.
Getting ready
To step through this recipe, you will need the following:
- A working Docker installation
- A Rails application
How to do it…
Here are our standard requirements:
- This Rails application needs Ruby 2.3
- All dependencies are handled by Bundler, and need to be installed in the container
- Node 5 is also needed
- We want assets to be precompiled in the image (putting them somewhere else is out of scope)
Here's...