This devcontainer contains Ruby 3.3.0, Postgres and Redis. You can update the Dockerfile and docker-compose.yml to add any other dependencies you may need.
When you use devcontainers for your Rails projects, each project is self-contained and its dependencies don't interfere with any other projects. Also your developer machine stays clean.
Another benefit is that the configuration is checked into the source code so other developers can clone down the repo and get to work without any additional setup required.
Make sure you have the Remote Development extension pack installed in VS Code.
.devcontainer
from this repo into the existing application.devcontainer/Dockerfile
with correct Ruby and Node versions you need (and any other dev dependencies)ruby -v
and rails -v
you are now in the devcontainer environment.cd
into itgem install rails
rails new . -d postgresql -c tailwind -j esbuild
(or whatever)bin/dev
to start normal rails dev serversdatabase.yml.example
on how to set the host
for the database. As the database is in docker you need to give the docker host name db
or the ENV VAR DB_HOST