Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 972 Bytes

README.md

File metadata and controls

50 lines (40 loc) · 972 Bytes

docker-rails

https://docs.docker.com/compose/rails/

install

# 初回のみ
# Gemfile作成
mkdir myapp && cd myapp
docker run --rm -v "$PWD":/usr/src/vb_app -w /usr/src/vb_app ruby:2.7.1 bundle init
touch Gemfile.lock
sudo chown -R dev: ./
vim Gemfile # gem Rails のコメントアウトを外す
docker-compose run --no-deps app bundle config set path vendor/bundle
docker-compose run --no-deps app bundle install
docker-compose run --no-deps app bundle exec rails new . --force --no-deps --database=postgresql
sudo chown -R $USER:$USER .
vim config/database.yml
docker-compose build

config/database.yml

default: &default
  adapter: postgresql
  encoding: unicode
  host: db
  username: postgres
  password: password
  pool: 5

development:
  <<: *default
  database: myapp_development


test:
  <<: *default
  database: myapp_test

立ち上げ

# 開始
docker-compose run app rake db:create
docker-compose up -d