项目作者: zazk

项目描述 :
Lightweight Rails 6 App over Docker Alpine images
高级语言: Dockerfile
项目地址: git://github.com/zazk/Rails-6-Docker-Alpine.git
创建时间: 2019-09-01T21:10:04Z
项目社区:https://github.com/zazk/Rails-6-Docker-Alpine

开源协议:

下载


Rails 6 Docker Alpine

Docker image size

  1. $ docker images
  2. REPOSITORY TAG SIZE
  3. blitz_web latest 390MB

Steps

  1. Clone & Create
  1. git clone git@github.com:zazk/Rails-6-Docker-Alpine.git

Create a new Rails application under the repository directory

  1. cd Rails-6-Docker-Alpine
  2. rails new . --webpack --database=postgresql
  1. Configure:

Modify your database configuration to use the postgresql container configuration:

  1. default: &default
  2. adapter: postgresql
  3. encoding: unicode
  4. pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  5. host: db
  6. username: postgres

Remove check Yarn

  1. # ./config/environments/development.rb
  2. # Disable Yarn Check
  3. config.webpacker.check_yarn_integrity = false
  1. Build the project:
  1. docker-compose build
  1. Create the database and run the migrations:
  1. docker-compose run --rm web bin/rails db:create
  2. docker-compose run --rm web bin/rails db:migrate
  1. Run the app:
  1. docker-compose up

Visit your application

  1. http://localhost:3000

Troubleshooting

  1. If you have probles with pg gem you should install Postgres before. On Mac brew install postgres
  2. Ruby Version 2.5.3