-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
93 lines (88 loc) · 2.11 KB
/
docker-compose.prod.yml
File metadata and controls
93 lines (88 loc) · 2.11 KB
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
# Production Docker Compose configuration for OptiView
# Usage: docker compose -f docker-compose.prod.yml up -d
services:
nginx:
build:
context: .
dockerfile: nginx/Dockerfile
args:
VITE_API_URL: ${VITE_API_URL}
container_name: optiview_nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
backend:
condition: service_healthy
networks:
- optiview-network
healthcheck:
test: ["CMD", "nginx", "-t"]
interval: 30s
timeout: 10s
retries: 3
backend:
build:
context: ./backend
dockerfile: Dockerfile
target: production
container_name: optiview_backend
restart: always
expose:
- "3000"
environment:
- NODE_ENV=production
- DB_HOST=postgres
- DB_PORT=5432
- DB_USERNAME=${DB_USERNAME:-postgres}
- DB_PASSWORD=${DB_PASSWORD:?DB_PASSWORD is required}
- DB_DATABASE=${DB_DATABASE:-optiview}
- PORT=3000
volumes:
- uploads_data:/app/uploads
depends_on:
postgres:
condition: service_healthy
networks:
- optiview-network
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: "1.5"
memory: 512M
postgres:
image: postgres:15-alpine
container_name: optiview_postgres
restart: always
environment:
POSTGRES_USER: ${DB_USERNAME:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD is required}
POSTGRES_DB: ${DB_DATABASE:-optiview}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- optiview-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-postgres} -d ${DB_DATABASE:-optiview}"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
networks:
optiview-network:
driver: bridge
volumes:
postgres_data:
uploads_data: