DEV Community

Cover image for Rails templates with docker
Ana Nunes da Silva
Ana Nunes da Silva

Posted on • Originally published at ananunesdasilva.com

Rails templates with docker

Starting new rails apps has never been easier for me. Here's why and how.

Before docker

You know when you want to start a new app, but you end up losing too much time setting it up, and solving issues with the dependencies on your machine? And after a while, you want to start another new project, only to find yourself going through the same steps and pains, to a point where you almost lose interest?

I've always wanted to find a way to start a new project on my machine, seamlessly. No hassle, just plug and play. But I never found a solution for that until I started using docker. Being able to start a rails project in under 5 minutes has given me back the joy of working on side projects and exploring new things.

After docker

So, recently I've decided to put together simple docker based templates with the tools I generally work with on a rails project:

Using github templates I can easily create new repositories based on a chosen template, clone it to my machine, run some docker-compose commands documented in the project's README, and voilà!

These templates are mostly based on the official docker quickstart tutorial for rails. They are currently set for ruby 3 and rails 6 but the beauty of docker is that you can go ahead and easily change them to whatever version you like, without the need to have anything installed on your computer. The same goes for postgres, mysql or whatever other tools you might add to these templates.

I'll be adding more as I start new rails apps with different toolsets that might be helpful in the future. For instance, I've currently started a new rails app with sidekiq and since I use sidekiq often, I know it's a good candidate for a template. I'll not create templates for all possible combinations of tools but mostly for those that involve adding containers, networking, or installing other dependencies. The idea is to save time with cumbersome configurations.

I'm happy to get feedback on these, feel free to use them, adapt them to your needs or just take some ideas to start your own. If you're fairly new to docker like me, I recommend you build your own from scratch. You'll learn a lot about docker and docker tools.

We're saved

Oldest comments (0)