-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
97 lines (92 loc) · 2.79 KB
/
Copy pathdocker-compose.yml
File metadata and controls
97 lines (92 loc) · 2.79 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
services:
mlflow:
# MLflow tracking server:
# - stores experiment runs
# - stores logged artifacts/model metadata
build:
context: .
dockerfile: docker/Dockerfile.mlflow
ports:
# Host:Container
- "5000:5000"
volumes:
# Persist MLflow database/artifacts across restarts.
- mlflow:/mlflow
# Automatically restart unless explicitly stopped by an operator.
restart: unless-stopped
healthcheck:
# Healthcheck lets Docker know if the service is actually responding.
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/').read()"]
interval: 10s
timeout: 3s
retries: 10
api:
# FastAPI inference service.
build:
context: .
dockerfile: docker/Dockerfile.api
environment:
# API uses MLflow for model loading/registration and local data volume for logs.
MLFLOW_TRACKING_URI: http://mlflow:5000
MLFLOW_MODEL_URI: ${MLFLOW_MODEL_URI:-}
MODEL_PATH: ${MODEL_PATH:-}
PREDICTION_LOG_PATH: /app/data/predictions.jsonl
API_KEY: ${API_KEY:-}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
MAX_UPLOAD_MB: ${MAX_UPLOAD_MB:-10}
ports:
- "8000:8000"
volumes:
# Mount local data folder so predictions/reference files are accessible on the host.
- ./data:/app/data
depends_on:
- mlflow
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()"]
interval: 10s
timeout: 3s
retries: 10
nginx:
# Public entrypoint / reverse proxy in front of the API.
image: nginx:1.27-alpine
ports:
- "8080:80"
volumes:
# Inject our custom proxy config.
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api
restart: unless-stopped
prometheus:
# Metrics collector. Periodically scrapes /metrics from the API.
image: prom/prometheus:v2.55.1
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus:/prometheus
depends_on:
- api
restart: unless-stopped
grafana:
# Dashboard UI on top of Prometheus metrics.
image: grafana/grafana:11.5.2
ports:
- "3000:3000"
environment:
# Default local login for development.
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
volumes:
# Persist dashboards/settings and auto-provision datasource config.
- grafana:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
depends_on:
- prometheus
restart: unless-stopped
volumes:
# Named volumes survive container recreation.
mlflow: {}
prometheus: {}
grafana: {}