Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomoki171923/docker-rails7
Ruby on Rails 7 on docker-compose
https://github.com/tomoki171923/docker-rails7
docker-compose rails7
Last synced: 18 days ago
JSON representation
Ruby on Rails 7 on docker-compose
- Host: GitHub
- URL: https://github.com/tomoki171923/docker-rails7
- Owner: tomoki171923
- License: mit
- Created: 2022-09-02T08:02:51.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-02T17:28:05.000Z (about 2 years ago)
- Last Synced: 2024-10-17T09:02:09.853Z (about 1 month ago)
- Topics: docker-compose, rails7
- Language: Dockerfile
- Homepage:
- Size: 70.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**Table of Contents**
- [docker-rails7](#docker-rails7)
- [version](#version)
- [setup pre-commit](#setup-pre-commit)
- [setup development environment](#setup-development-environment)
- [create rails application](#create-rails-application)
- [build docker container](#build-docker-container)
- [create database](#create-database)
- [access rails application](#access-rails-application)
- [db migrate & insert data](#db-migrate--insert-data)# docker-rails7
ruby on rais7 api mode on docker.
## version
Ruby : 3.1.2
Rails : 7.0.3
Postgres : 14.5
## setup pre-commit
install rbenv & pre-commit
```
brew install rbenv ruby-build
brew install pre-commit
```install ruby & rubocop (for pre-commit)
```
rbenv install 3.1.2
rbenv local 3.1.2
rbenv exec gem install rubocop
rbenv exec gem install rubocop-performance
rbenv exec gem install rubocop-rails
```apply pre-commit config
```
pre-commit install
```## setup development environment
### create rails application
```
docker-compose run --rm --no-deps api rails new . --force --database=postgresql --api
```### build docker container
```
cp -p local/rails/database.yml.org config/database.yml
docker-compose up -d --build
```### create database
```
docker exec local_rails_api rake db:create
```### access rails application
(it will take some time.)
access
### db migrate & insert data
```
docker exec local_rails_api rails generate scaffold user name:string age:integer area:string
docker exec local_rails_api rake db:migrate
```write the following into db/seeds.rb
```
User.create(:name => 'Test', :age => '20', :area => 'Tokyo')
``````
docker exec local_rails_api rails db:seed
```access