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.
- Clone this repo
- Copy the
.devcontainer
from this repo into the existing application - Modify the
.devcontainer/Dockerfile
with correct Ruby and Node versions you need (and any other dev dependencies) - Start vscode and it will prompt you to start the project in a dev container - yes!
- Open the integrated terminal in vscode and type
ruby -v
andrails -v
you are now in the devcontainer environment.
- Clone this repo
cd
into it- Start vscode and it will prompt you to start the project in a dev container - yes!
- Open the integrated terminal in vscode
gem install rails
rails new . -d postgresql -c tailwind -j esbuild
(or whatever)bin/dev
to start normal rails dev servers
- see the
database.yml.example
on how to set thehost
for the database. As the database is in docker you need to give the docker host namedb
or the ENV VARDB_HOST