-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
executable file
·116 lines (109 loc) · 2.64 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
executable file
·116 lines (109 loc) · 2.64 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
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: patient_db_prod
environment:
POSTGRES_DB: patient_management
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres123}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- patient_network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 3
# Redis Cache
redis:
image: redis:7-alpine
container_name: patient_cache_prod
volumes:
- redis_data:/data
networks:
- patient_network
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
# Backend API
backend:
build:
context: ./backend
dockerfile: Dockerfile
target: production
container_name: patient_api_prod
environment:
NODE_ENV: production
PORT: 3001
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: patient_management
DB_USER: postgres
DB_PASSWORD: ${DB_PASSWORD:-postgres123}
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET:-your-super-secret-jwt-key}
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:3000}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- patient_network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
interval: 30s
timeout: 10s
retries: 3
# Frontend React App
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: production
container_name: patient_web_prod
environment:
REACT_APP_API_URL: ${REACT_APP_API_URL:-http://localhost:3001/api}
REACT_APP_ENV: production
depends_on:
- backend
networks:
- patient_network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
container_name: patient_proxy_prod
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- frontend
- backend
networks:
- patient_network
restart: unless-stopped
volumes:
postgres_data:
redis_data:
networks:
patient_network:
driver: bridge