Docker Rails

Dockerize Rails 7 with ActionCable, Webpacker, Stimulus, Elasticsearch, Sidekiq
Alternatives To Docker Rails
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Docker Rails1,081
a day ago2mitRuby
Dockerize Rails 7 with ActionCable, Webpacker, Stimulus, Elasticsearch, Sidekiq
Rails7 Startkit523
3 days ago7mitRuby
Launch Rails with 1 shell command!
2 years ago3mitRuby
RSS as RESTful. This service allows you to transform RSS feed into an awesome API.
Awesome Ruby China315
4 years ago
A collection of excellent topics.
7 years ago2mitRuby
Example App for Elasticsearch Series
3 years ago25mitRuby
Collecting kleine Anfragen from Parlamentsdokumentationssystemen for easy search- and linkability
110 years ago7July 26, 20134mitRuby
Update tire (elasticsearch) index async with Sidekiq or Resque
E Manifest11
7 years ago4otherRuby
The EPA e-Manifest project
San Pedro Valley Jobs11
7 years ago7mitRuby
Repositório do novo Job Board de San Pedro Valley
8 years ago1mitRuby
Active Record wrapper for ElasticSearch
Alternatives To Docker Rails
Select To Compare

Alternative Project Comparisons



Simple Rails 6 application to demonstrate using Docker for production deployment. The application is a very simple kind of CMS (content management system) allowing to manage posts. Beside the boring CRUD functionality it has some non-default features.

This project aims to build a lean Docker image for use in production. Therefore it's based on the official Alpine Ruby image, uses multi-stage building and some optimizations that I described in my blog. This results in an image size of ~80MB.



This project demonstrates my way of building Rails applications. The techniques used to build the app should not be considered as "best practice", maybe there are better ways to build. Any feedback would be appreciated.

Multi container architecture

There is a separate docker-compose.yml for development and production. The whole stack is divided into multiple different containers:

  • app: Main part. It contains the Rails code to handle web requests (by using the Puma gem). See the Dockerfile for details. The image is based on the Alpine variant of the official Ruby image and uses multi-stage building.
  • worker: Background processing. It contains the same Rails code, but only runs Sidekiq
  • db: PostgreSQL database
  • elasticsearch: Full text search engine
  • redis: In-memory key/value store (used by Sidekiq, ActionCable and for caching)
  • backup: Regularly backups the database as a dump via CRON to an Amazon S3 bucket

Check it out!

To start up the application in your local Docker environment:

git clone
cd docker-rails
docker-compose build
docker-compose run app yarn install
docker-compose up

Wait some minutes while the database will be prepared by fetching articles from Wikipedia. Then, navigate your browser to http://[DOCKER_HOST]:[DOCKER_PORT].

Sign in to the admin account:


Tests / CI

On every push, the test suite (including RuboCop checks) is performed via GitHub Actions. If successful, a production image is built and pushed to a private GitLab Docker Registry.

Production deployment

The Docker image build for production is different from development. It includes precompiled assets only (no node_modules and no sources). The spec folder is removed and the Alpine packages for Node and Yarn are not installed.

The stack is ready to host with traefik or nginx proxy and letsencrypt-nginx-proxy-companion. See docker-compose.production.yml for example setup.


A demo installation is set up on

Popular Sidekiq Projects
Popular Elasticsearch Projects
Popular Control Flow Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Ruby On Rails
File Upload