Rails + MySQL + Vue.js in Docker container.
- Rails 5+
- Ruby 2.4.2
- MySQL 5.7
- Yarn
- Node.js 6+
- Vue.js
$ mkdir myapp
$ cp -r docker-rails/* myapp/
$ cd myapp/
$ docker-compose run web rails new . -f -d mysql -BT --skip-coffee --skip-turbolinks
+ gem 'webpacker', '~> 3.0'
+ gem 'foreman', group: :development
$ docker-compose run web bundle install
$ docker-compose build
โป To avoid webpack binstubs not found error.
$ docker-compose run web bundle binstubs webpacker --path=bin/
$ docker-compose run web rails webpacker:install
$ docker-compose run web rails webpacker:install:vue
default: &default
adapter: mysql2
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password:
- host: localhost
+ host: db
$ docker-compose run web rails db:create
$ docker-compose run web rails db:migrate
$ docker-compose up
Open http://localhost:3000.
Enjoy Hacking !!
$ docker-compose run web bundle binstubs webpacker --path=bin/