tearat / rails-docker-example

ROR app via Docker (CRUD example)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

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

touch Gemfile.lock
docker-compose run web rails new . --force --no-deps --database=postgresql
sudo chown -R $USER:$USER .
docker-compose build

Replace the contents of config/database.yml with the following:

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

development:
    <<: *default
    database: myapp_development

test:
    <<: *default
    database: myapp_test

You can now boot the app with docker-compose up:

su -
docker-compose up

Finally, you need to create the database. In another terminal, run: docker-compose run web rake db:create

Stop the application

docker-compose down

Restart the application

docker-compose up

Dev

alias rails='docker exec rails_web_1 rails'

About

ROR app via Docker (CRUD example)


Languages

Language:Ruby 72.5%Language:HTML 20.3%Language:JavaScript 2.9%Language:CSS 2.2%Language:Dockerfile 1.1%Language:CoffeeScript 0.5%Language:Shell 0.5%