Source: Ruby on Whales: Dockerizing Ruby and Rails development.
- Docker installed.
For MacOS just use the official app.
dipinstalled.
You can install dip as Ruby gem:
gem install dipWhen using Dip it could be done with a single command:
dip provisiondip rails s# run rails console
dip rails c
# run rails server with debugging capabilities (i.e., `debugger` would work)
dip rails s
# or run the while web app (with all the dependencies)
dip up web
# run migrations
dip rails db:migrate
# pass env variables into application
dip VERSION=20100905201547 rails db:migrate:down
# simply launch bash within app directory (with dependencies up)
dip runner
# execute an arbitrary command via Bash
dip bash -c 'ls -al tmp/cache'
# Additional commands
# update gems or packages
dip bundle install
# run psql console
dip psql
# run tests
# TIP: `dip rspec` is already auto prefixed with `RAILS_ENV=test`
dip rspec spec/path/to/single/test.rb:23
# shutdown all containers
dip down