This devcontainer contains Ruby 3.2.2, 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 Remove Development extension pack installed in VS Code.
- Clone this repo
- Copy the
.devcontainerfrom this repo into the existing application - Modify the
.devcontainer/Dockerfilewith 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 -vandrails -vyou are now in the devcontainer environment.
- Clone this repo
cdinto 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/devto start normal rails dev servers
- see the
database.yml.exampleon how to set thehostfor the database. As the database is in docker you need to give the docker host namedbor the ENV VARDB_HOST