-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
80 lines (75 loc) · 1.93 KB
/
docker-compose.yml
File metadata and controls
80 lines (75 loc) · 1.93 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
version: '3.8'
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- DATABASE_URL=sqlite:///./ml_registry.db
- DEBUG=true
- CORS_ORIGINS=["http://localhost:3000","http://localhost:80","http://frontend:80"]
volumes:
- backend_data:/app/data
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "3000:80"
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
# PostgreSQL for production-like environment
db:
image: postgres:15-alpine
environment:
- POSTGRES_USER=mlregistry
- POSTGRES_PASSWORD=mlregistry_secret
- POSTGRES_DB=ml_registry
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mlregistry -d ml_registry"]
interval: 10s
timeout: 5s
retries: 5
profiles:
- postgres
# Backend with PostgreSQL
backend-postgres:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://mlregistry:mlregistry_secret@db:5432/ml_registry
- DEBUG=false
- CORS_ORIGINS=["http://localhost:3000","http://localhost:80"]
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
profiles:
- postgres
volumes:
backend_data:
postgres_data: