Docker image size
$ docker images
REPOSITORY TAG SIZE
blitz_web latest 390MB
- Clone & Create
git clone [email protected]:zazk/Rails-6-Docker-Alpine.git
Create a new Rails application under the repository directory
cd Rails-6-Docker-Alpine
rails new . --webpack --database=postgresql
- Configure:
Modify your database configuration to use the postgresql container configuration:
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: db
username: postgres
Remove check Yarn
# ./config/environments/development.rb
# Disable Yarn Check
config.webpacker.check_yarn_integrity = false
- Build the project:
docker-compose build
- Create the database and run the migrations:
docker-compose run --rm web bin/rails db:create
docker-compose run --rm web bin/rails db:migrate
- Run the app:
docker-compose up
Visit your application
http://localhost:3000
- If you have probles with
pg
gem you should install Postgres before. On Macbrew install postgres
- Ruby Version
2.5.3