- clone this repository
cd
into created directory- run
docker-compose build
- create a new rails app in the directory with:
docker-compose run --no-deps app rails new . -d postgresql
- Edit
config/database.yml
and set up the host and username:
...
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: db
username: postgres
...
- Generate the databases with
docker-compose run app bundle exec rails db:create
- Start the app with
docker-compose up
- Nagivate to http://localhost on your browser. You should see the rails welcome page.
- Copy the
Dockerfile
,docker-compose.yml
andentrypoint.sh
files into the root of your app. - Build the image with
docker-compose build
- Follow from step 5 above