-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
163 lines (154 loc) · 4.27 KB
/
docker-compose.prod.yml
File metadata and controls
163 lines (154 loc) · 4.27 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
version: '3.8'
services:
# Database
postgres:
image: postgres:15-alpine
container_name: enterprise-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-enterprise_crm}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./database/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
- ./database/migrations:/docker-entrypoint-initdb.d/migrations:ro
networks:
- enterprise-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
# Services Service
services-service:
build:
context: ./services-service
dockerfile: Dockerfile
image: enterprise-services-service:prod
container_name: enterprise-services-service
restart: unless-stopped
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-enterprise_crm}
- JWT_SECRET=${JWT_SECRET}
- PORT=3001
depends_on:
postgres:
condition: service_healthy
networks:
- enterprise-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
# Quotes Service
quotes-service:
build:
context: ./quotes-service
dockerfile: Dockerfile
image: enterprise-quotes-service:prod
container_name: enterprise-quotes-service
restart: unless-stopped
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-enterprise_crm}
- JWT_SECRET=${JWT_SECRET}
- PORT=3002
depends_on:
postgres:
condition: service_healthy
networks:
- enterprise-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3002/health"]
interval: 30s
timeout: 10s
retries: 3
# OCR Service
ocr-service:
build:
context: ./ocr-service
dockerfile: Dockerfile
args:
DOCKER_BUILDKIT: 0
image: enterprise-ocr-service:prod
container_name: enterprise-ocr-service
restart: unless-stopped
environment:
- JWT_SECRET=${JWT_SECRET}
- PYTHONUNBUFFERED=1
volumes:
- ocr_uploads:/app/uploads
networks:
- enterprise-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
# API Gateway
api-gateway:
build:
context: ./api-gateway
dockerfile: Dockerfile
image: enterprise-api-gateway:prod
container_name: enterprise-api-gateway
restart: unless-stopped
environment:
- NODE_ENV=production
- JWT_SECRET=${JWT_SECRET}
- SERVICES_SERVICE_URL=http://services-service:3001
- QUOTES_SERVICE_URL=http://quotes-service:3002
- OCR_SERVICE_URL=http://ocr-service:8000
- PORT=3000
depends_on:
- services-service
- quotes-service
- ocr-service
networks:
- enterprise-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
# Frontend (Next.js App)
frontend:
build:
context: ./frontend-next
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_API_BASE_URL=${NEXT_PUBLIC_API_BASE_URL:-https://cactoos.digital/api}
- NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL:-https://cactoos.digital}
image: enterprise-frontend-next:prod
container_name: enterprise-frontend-next
restart: unless-stopped
networks:
- enterprise-network
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
container_name: enterprise-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
- ./ssl:/etc/nginx/ssl:ro
- nginx_logs:/var/log/nginx
depends_on:
- frontend
- api-gateway
networks:
- enterprise-network
volumes:
postgres_data:
ocr_uploads:
nginx_logs:
networks:
enterprise-network:
driver: bridge