Skip to content

Commit ed500f6

Browse files
ryanwigauravtiwari
authored andcommitted
Include the Webpacker host on the web/app service (#2311)
The environment variable for WEBPACKER_DEV_SERVER_HOST is required for the web/app container to be able to proxy /packs requests to the webpack-dev-server container.
1 parent 848fefd commit ed500f6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/docker.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Docker
22

3-
To setup webpacker with a dockerized Rails application is trivial.
3+
To setup webpacker with a dockerized Rails application.
44

55
First, add a new service for webpacker in docker-compose.yml:
66

@@ -61,6 +61,24 @@ RAILS_ENV=development
6161
WEBPACKER_DEV_SERVER_HOST=0.0.0.0
6262
```
6363

64+
then add the webpacker host name environment variable to the web/app service:
65+
66+
```Dockerfile
67+
web:
68+
build:
69+
context: .
70+
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
71+
volumes:
72+
- .:/usr/src/app
73+
ports:
74+
- "3000:3000"
75+
environment:
76+
- DATABASE_URL=postgres://postgres@db
77+
- WEBPACKER_DEV_SERVER_HOST=webpacker
78+
depends_on:
79+
- db
80+
```
81+
6482
Lastly, rebuild your container:
6583

6684
```bash

0 commit comments

Comments
 (0)