


Gpg -dearmor -o /usr/share/keyrings/postgres-archive-keyring.gpg \ Git # Install PostgreSQL dependencies ARG PG_MAJOR RUN curl -sSL | \ & DEBIAN_FRONTEND=noninteractive apt-get install -yq -no-install-recommends \ Rm -f /etc/apt//docker-clean \Įcho 'Binary::apt::APT::Keep-Downloaded-Packages "true" ' > /etc/apt//keep-cache \ # syntax=docker/dockerfile:1 ARG RUBY_VERSION ARG DISTRO_NAME=bullseye FROM ruby: $RUBY_VERSION-slim- $DISTRO_NAME ARG DISTRO_NAME # Common dependencies RUN -mount = type=cache,target=/var/cache/apt,sharing=locked \ -mount = type=cache,target=/var/lib/apt,sharing=locked \ -mount = type=tmpfs,target=/var/log \ This environment is where we’ll run servers, access the console ( rails c), perform tests, do Rake tasks, and otherwise interact with our code in any way as developers: The Dockerfile defines our Ruby application’s environment.

It took quite some time to develop a standard approach (as more formerly enshrined with the first release of this article in 2019). And something which was just good enough would not cut it. But don’t get the impression that this was an instant fix! I was in search of a configuration that was perfect for myself, my team, and well, everyone else. In 2017, I decided to make the switch to containers, and this was how I first began using Docker. So, where to start? This has been a pretty long journey: back in the day, I used to develop using Vagrant, but its VMs were a bit too heavy for my 4GB RAM laptop. Notice: This article is regularly updated with the best and latest recommendations for details, take a look at the Changelog. Read on to learn all the details, and feel free to use it, share it, and enjoy! This configuration came out of-and then further evolved-during production development at Evil Martians.

This post introduces the Docker configuration I use for developing my Ruby on Rails projects.
