-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.prod.yml
60 lines (55 loc) · 1.31 KB
/
docker-compose.prod.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
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./frontend/nginx.conf:/etc/nginx/conf.d/default.conf
- ./frontend/build:/usr/share/nginx/html
networks:
- main
depends_on:
- backend
restart: unless-stopped
redis:
image: redis:alpine
# In production, we don't expose Redis port to the host
expose:
- '6379'
networks:
- main
volumes:
- redis_data:/data
restart: unless-stopped
command: redis-server --appendonly yes # Enable persistence
backend:
build:
context: ./backend
dockerfile: Dockerfile.prod # You'll need to create this
expose:
- '5000' # Only expose to internal network
networks:
- main
environment:
- NODE_ENV=production
- REDIS_SERVER_IP=redis
depends_on:
- redis
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.prod # You'll need to create this
networks:
- main
environment:
- NODE_ENV=production
depends_on:
- backend
# No ports needed as Nginx will serve the static files
# No volumes needed as we'll copy the built files during build
networks:
main:
driver: bridge
volumes:
redis_data: # Persistent volume for Redis data