Start copying the following template: https://github.com/new?template_name=docker-rails7&template_owner=gjuliao
This app demonstrates Rails 7 with PostgreSQL, import maps, turbo, stimulus and hotwire, all running in Docker.
- Rails 7
- Ruby 3
- Dockerfile and Docker Compose configuration
- PostgreSQL database
- Redis
- GitHub Actions for
- tests
- Rubocop for linting
- Security checks with Brakeman and bundler-audit
- Building and testing of a production Docker image
- Dependabot for automated updates
Please ensure you are using Docker Compose V2. This project relies on the docker compose
command, not the previous docker-compose
standalone program.
https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command
Check your docker compose version with:
% docker compose version
Docker Compose version v2.10.2
- create a .env file, and add the following variables:
- POSTGRES_DB=db
- PGHOST=db
- POSTGRES_USER=postgres # change it as needed
- POSTGRES_PASSWORD=password12345 # change it as needed
docker compose build
docker compose run --rm web bin/rails db:setup
docker compose up
- Check original template: https://github.com/ryanwi/rails7-on-docker/generate