-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
94 lines (90 loc) · 1.87 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# version: "3"
# services:
# mongodb:
# image: "mongo"
# ports:
# - "27017:27017"
# backend:
# build: ./backend/
# ports:
# - "8080:8080"
# volumes:
# - ./backend:/usr/src/app
# depends_on:
# - mongodb
# frontend:
# build: ./frontend/
# ports:
# - "3000:3000"
# volumes:
# - ./frontend:/usr/src/app
# depends_on:
# - backend
#######
#######
#######
version: "3"
services:
##########################
### SETUP SERVER CONTAINER
##########################
backend:
# Tell docker what file to build the backend from
build:
context: ./backend
dockerfile: Dockerfile
# The ports to expose
expose:
- 4000
# Environment variables
environment:
- MONGO_URI=mongodb://db:27017/db
- PORT=4000
- JWT_SECRET=secretsecret
- JWT_EXPIRY=30d
- DEBUG=worker:*
- MORGAN=combined
- NODE_ENV=development
# Port mapping
ports:
- 4000:4000
# Volumes to mount
volumes:
- ./backend:/app/backend
# Run command
# Nodemon for hot reloading (-L flag required for polling in Docker)
command: nodemon -L server.js
# Connect to other containers
links:
- db
# Restart action
restart: always
##########################
### SETUP CLIENT CONTAINER
##########################
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
environment:
- REACT_APP_PORT=3000
- CHOKIDAR_USEPOLLING=true
expose:
- 3000
ports:
- 3000:3000
volumes:
- ./frontend:/app/frontend/src
- ./frontend:/app/frontend/public
links:
- backend
command: npm start
restart: always
##########################
### SETUP DB CONTAINER
##########################
db:
image: mongo
ports:
- 27017:27017
restart: always