-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
155 lines (149 loc) · 4.33 KB
/
docker-compose.yml
File metadata and controls
155 lines (149 loc) · 4.33 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
services:
# ===================================
# DATABASE – PostgreSQL Local
# ===================================
db:
image: postgres:16-alpine
container_name: siprems-db
restart: unless-stopped
ports:
- "5432:5432"
environment:
- POSTGRES_DB=siprems
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
- ./scripts/supabase-dump.sql:/docker-entrypoint-initdb.d/supabase-dump.sql
networks:
- siprems-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d siprems"]
interval: 10s
timeout: 5s
retries: 5
# ===================================
# BACKEND TypeScript – Express
# ===================================
backend:
build:
context: ./backend-ts
dockerfile: Dockerfile
container_name: siprems-backend-ts
restart: unless-stopped
ports:
- "8000:8000"
env_file:
- ./backend-ts/.env
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/siprems
- PORT=8000
- ML_SERVICE_URL=http://ml-service:8001
- GEMINI_API_KEY=${GEMINI_API_KEY}
depends_on:
db:
condition: service_healthy
ml-service:
condition: service_healthy
networks:
- siprems-network
healthcheck:
test: [ "CMD", "wget", "-q", "--spider", "http://localhost:8000/health" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
# ===================================
# ML SERVICE Python – Prophet Models
# ===================================
ml-service:
build:
context: ./ml-service
dockerfile: Dockerfile
container_name: siprems-ml-service
restart: unless-stopped
ports:
- "8001:8001"
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/siprems
- PORT=8001
depends_on:
db:
condition: service_healthy
volumes:
- model_data:/app/models # Model persistence
networks:
- siprems-network
healthcheck:
test: [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# ===================================
# FRONTEND – React/Vite
# ===================================
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
target: development # Change to "production" for production builds
container_name: siprems-frontend
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./src:/app/src
- ./public:/app/public
- ./vite.config.ts:/app/vite.config.ts
- ./index.html:/app/index.html
environment:
- VITE_API_BASE_URL=http://localhost:8000/api
- VITE_FIREBASE_API_KEY=${VITE_FIREBASE_API_KEY}
- VITE_FIREBASE_AUTH_DOMAIN=${VITE_FIREBASE_AUTH_DOMAIN}
- VITE_FIREBASE_PROJECT_ID=${VITE_FIREBASE_PROJECT_ID}
- VITE_FIREBASE_STORAGE_BUCKET=${VITE_FIREBASE_STORAGE_BUCKET}
- VITE_FIREBASE_MESSAGING_SENDER_ID=${VITE_FIREBASE_MESSAGING_SENDER_ID}
- VITE_FIREBASE_APP_ID=${VITE_FIREBASE_APP_ID}
depends_on:
backend:
condition: service_healthy
networks:
- siprems-network
# ===================================
# RETRAIN SCHEDULER (Optional)
# ===================================
retrain-scheduler:
build:
context: ./ml-service
dockerfile: Dockerfile
container_name: siprems-retrain-scheduler
restart: "no"
command: [ "python", "/app/train_on_startup.py" ]
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/siprems
- ML_SERVICE_URL=http://ml-service:8001
depends_on:
db:
condition: service_healthy
ml-service:
condition: service_healthy
networks:
- siprems-network
profiles:
- scheduler # Only start with: docker compose --profile scheduler up
# ===================================
# VOLUMES
# ===================================
volumes:
postgres_data:
driver: local
model_data:
driver: local
# ===================================
# NETWORKS
# ===================================
networks:
siprems-network:
driver: bridge