docker-rails-demo
docker-rails-demo copied to clipboard
Demo project for Ruby on Rails using Docker and Webpacker
Welcome to Docker Rails Demo
Rails, Docker and Webpacker is an awesome combination, for instance to develop React/Rails apps with. This demo app uses Rails 6, Webpacker and Docker. In development mode, it uses webpack-dev-server for live Javascript reloading. As database it uses PostgreSQL.
Read the blog post with background info about his repository at Running a Rails app with Webpacker and Docker
First, build the app for development purposes
docker-compose build
Create the database
docker-compose run web scripts/wait-for-it.sh db:5432 -- "rails db:create db:migrate"
Run the app in development mode
docker-compose up
Now open http://localhost:3000 and look at your Javascript console to see messages
Entering the web container
docker-compose exec web bash
Creating a new config/master.key and config/credentials.yml.enc
You will need these 2 files for the asset pipeline for the production build.
First enter the web container as highlighed above. Then run:
run EDITOR=vim rails credentials:edit
exit and save via :wq
Build the app for production
docker build -t docker-rails-demo .
Released under the MIT License