Docker Ruby On Rails Development

Creating a rails image.
Docker ruby on rails development. That ll put your application code inside an image that builds a container with ruby bundler and all your dependencies inside it. To provide an example of how you might move to containerized development i built a simple todo api with ruby on rails and postgresql using docker compose for development testing and eventually in my ci cd pipeline. The app ruby on rails container is based on linux ubuntu 18 0 4 bionic image to ensure that it would work equally the same way both in development and production. For more information on how to write dockerfiles see the docker user guide and the dockerfile reference.
This post is a b side of my railsconf 2019 talk terraforming legacy rails applications today i am not going to convince you to switch to docker for application development though you can check the railsconf video for some arguments. For that we ll need a dockerfile. It ll be overwritten in a moment by rails new. Since i use docker i decided to compile ruby from the source as there is no real need to use the version managers like rvm or rbenv.
Now if you plan on building ruby on rails projects with dockerfiles you re ready. We can do this by using the official ruby docker image. Ruby on rails container. My goal is to share the configuration i currently use for rails projects and which was born in production development at evil martians.
If you are actively developing an application using docker can simplify your workflow and the process of deploying your application to production. Below is a condensed version of the talk which covers an introduction to containerization and the docker ecosystem as well as. This tutorial will show you how to set up a development environment for a ruby on rails application usi. And that s all there is to creating a rails development environment with the help of docker.
We re going to generate a new rails project without even needing ruby installed on our work station. Next create a bootstrap gemfile which just loads rails. From 0 to fargate migrating your ruby on rails app to docker this is the second article in a series about migrating your production application stack to docker and aws fargate. We ll install rails on a docker container.
A dockerfile contains all the commands that you would need to install the.