-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdocker-compose.yml
42 lines (41 loc) · 1.56 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
version: '3.3'
services:
react:
build:
context: .
dockerfile: ./Dockerfile.react
image: local/react
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules/ # mounts empty folder so npm can install on the image
restart: always
environment:
- CHOKIDAR_USEPOLLING=true # enable fs event forwarding for file change detection (webpack)
ports: # these services all share ports in Dev mode (see network_mode)
- 3000:3000 # defines port mapping for React dev server
- 3001:3001 # defines port mapping for Express API server
- 3306:3306 # defines port mapping for MySql
command: npm run react:start
db:
image: mysql:5.7
restart: "no"
#volumes:
#- ./data/mysql:/var/lib/mysql # Mac/Linux: uncomment to persist data
network_mode: service:react # share this network with React service
environment:
- MYSQL_DATABASE=react
- MYSQL_USER=root
- MYSQL_ROOT_PASSWORD=root
api:
build:
context: .
dockerfile: ./Dockerfile.express
image: local/express
volumes:
- ./api:/usr/src/app
- /usr/src/app/node_modules/ # mounts empty folder so npm can install on the image
restart: always
network_mode: service:react # share this network with React service so the proxy in package.json will work correctly
environment:
- PORT=3001
- CHOKIDAR_USEPOLLING=true # enable fs event forwarding for file change detection (webpack)