A Guide for Running Rails in Docker

preview_player
Показать описание
We'll go over an example app using Sidekiq, Action Cable, Postgres, Redis, esbuild & TailwindCSS.

Hit the subscribe button to receive more videos like this!

REFERENCE LINKS
---------------------------------------------------

COURSES
---------------------------------------------------
Courses I've created that focus on web dev and deployment topics.

THE TOOLS I USE / GEAR
---------------------------------------------------

FOLLOW ME ELSEWHERE
---------------------------------------------------

TIMESTAMPS
---------------------------------------------------
0:00 -- Intro
0:10 -- Rails 7.1 will generate a Dockerfile
1:52 -- Docker Compose is important
6:01 -- Controlling which containers run in different envs
8:51 -- Using a run script to make it easy to run Docker commands
10:52 -- Handling a lack of TTY with Docker Compose
12:26 -- Running esbuild and Tailwind in development
13:59 -- Running tests while setting RAILS_ENV=test
16:20 -- Limiting log levels in tests
17:37 -- Handling lock files and dependencies
21:15 -- A couple of shortcuts for common dependency commands
22:31 -- A custom node_modules directory
25:33 -- Configuring your database
28:34 -- Configuring Puma and Sidekiq
30:30 -- Web console access
33:30 -- The .dockerignore file
36:13 -- Injecting env variables at container run-time
37:38 -- The Dockerfile
37:59 -- Using Debian slim for a smaller image
43:01 -- Multi-stage builds
46:58 -- Docker is smart when it pulls images
47:50 -- Only installing gems when your Gemfile changes
49:57 -- Running your containers as a non-root user
53:52 -- Only pre-compiling assets in non-dev environments
55:57 -- Copying pre-compiled assets in a volume friendly way
58:21 -- Ensuring the latest sprockets manifest file is used
1:01:58 -- Where should you run database migrations?
1:07:23 -- Running multiple commands from the same Docker image
1:09:23 -- Environment variable interpolation
1:09:48 -- Dev / prod parity is important
1:10:57 -- Questions?
Рекомендации по теме
Комментарии
Автор

I have to say this is by far the easiest Docker example I've ever had the pleasure of working with. Seriously, I got zero error the first time simply by following the instructions. Thank you for providing such a great resource. I plan on using it to learn all about Dockerizing Rails. Cheers Nick!

JoshuaNeedham
Автор

I'm playing with this project for the past week and it's incredible. Now I want to use Kubernetes to deploy to Digital Ocean. Is there any chance of a video depicting the deployment part? :D

Alimenteocerebro
Автор

Fantastic project and video. How hard it will be to use MRSK with this repo?

Alimenteocerebro
Автор

Great video, I appreciate your effort !
I have a question about the response time:
When I cloned your repo and just visited the localhost, dev tools showed ~2s for loading the home page, where on the other hand when I launched some sample application it was around 80ms(home page as well).
Is there a reason for that ? Or am I missing something/ set the app incorrectly 🤔

lorem_ipsumm
Автор

I see a lot of people using puma these days, do they ever consider writing thread safe code? I still use passenger to run my rails apps, and when I see this, I am wondering if I am missing something, should I just put a puma server and write my code like I was always writing it?

simomed
Автор

Thank you for the guide but please clean a bit your speech from fillers)

valik-stu