February 2019
Intermediate to advanced
240 pages
5h 25m
English
As part of Webpacker, Rails provides the webpack-dev-server binary. This is a small server that runs in the background, automatically compiling our webpack-managed files.
If you were developing locally, this would just be another command you’d issue from your terminal. However, the Docker way is to run this as a separate service in its own container.
Let’s add a new service for it to our docker-compose.yml file:
| 1: | version: '3' |
| - | |
| - | services: |
| - | web: |
| 5: | build: . |
| - | ports: |
| - | - "3000:3000" |
| - | volumes: |
| - | - .:/usr/src/app |
| 10: | env_file: |
| - | - .env/development/web |
| - | - .env/development/database |
| - | environment: |
| - | - WEBPACKER_DEV_SERVER_HOST=webpack_dev_server |
| 15: | |
| - | webpack_dev_server: |
| - | build: ... |
Read now
Unlock full access