-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
93 lines (87 loc) · 2.65 KB
/
docker-compose.yml
File metadata and controls
93 lines (87 loc) · 2.65 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
services:
# PostgreSQL Database
db:
image: postgres:16-alpine
container_name: stewardchms-db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-steward}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-steward123}
POSTGRES_DB: ${POSTGRES_DB:-stewardchms}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-steward} -d ${POSTGRES_DB:-stewardchms}"]
interval: 10s
timeout: 5s
retries: 5
# Backend API
backend:
build:
context: .
dockerfile: backend/Dockerfile
container_name: stewardchms-backend
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
NODE_ENV: production
PORT: 3001
DATABASE_URL: postgresql://${POSTGRES_USER:-steward}:${POSTGRES_PASSWORD:-steward123}@db:5432/${POSTGRES_DB:-stewardchms}
JWT_SECRET: ${JWT_SECRET:-change-this-in-production-please}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-7d}
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost}
ADMIN_EMAIL: ${ADMIN_EMAIL:-admin@stewardchms.local}
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin123}
ADMIN_NAME: ${ADMIN_NAME:-System Administrator}
ports:
- "3001:3001"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/api/health"]
interval: 30s
timeout: 10s
start_period: 10s
retries: 3
# Frontend (Nginx + React SPA)
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
container_name: stewardchms-frontend
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
ports:
- "80:80"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/"]
interval: 30s
timeout: 10s
start_period: 5s
retries: 3
# Database migrations runner (one-time job)
migrate:
build:
context: .
dockerfile: backend/Dockerfile.migrate
container_name: stewardchms-migrate
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-steward}:${POSTGRES_PASSWORD:-steward123}@db:5432/${POSTGRES_DB:-stewardchms}
ADMIN_EMAIL: ${ADMIN_EMAIL:-admin@stewardchms.local}
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin123}
ADMIN_NAME: ${ADMIN_NAME:-System Administrator}
command: >
sh -c "npx prisma migrate deploy && npm run db:seed"
restart: "no"
volumes:
postgres_data:
networks:
default:
name: stewardchms-network