The Ruby on Rails environment by Ruby, MariaDB, and Nginx that is defined by docker-compose.
this is build a docker-compose environment, and create a new Rails project on it.
docker-compose build
docker-compose run app bundle init
- add or change to
gem 'rails'
on Gemfile docker-compose run app bundle install
docker-compose run app bundle exec rails new ../${APP_NAME} --database=mysql
(${APP_NAME} is you set on docker-compose.yml)- you need overrite README.md (this file), Gemfile (created by bundle init), and .gitignore (is included this repositiory), maybe.
- edit
config/database.yml
, set the following;- set
<%= ENV.fetch('DB_PASSWORD') %>
topassword
- set
<%= ENV.fetch('DB_HOST') %>
tohost
- attention; THIS SETTING USE 'root' account of MariaDB
- set
docker-compose run app bundle exec rake db:create
- (Rails 6 only; append
config.hosts << 'app'
toconfig/application.rb
docker-compose up
- access to
http://<docker-host>/
by the web browser.
docker-compose build
docker-compose run app bundle install
docker-compose run app bundle exec rake db:create
docker-compose up
- access to
http://<docker-host>/
by the web browser.