-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (78 loc) · 3.03 KB
/
docker-compose.yml
File metadata and controls
82 lines (78 loc) · 3.03 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
# Docker Compose file for Food Rescue RL — local-dev orchestration.
#
# Usage:
# docker compose up mlflow # tracking server only
# docker compose --profile train run train # one-shot training
# docker compose --profile serve up serve # FastAPI server
# docker compose --profile serve --profile train up # all services
#
# ── Shared network so containers can reach each other by name ──────────────
networks:
rescue_net:
driver: bridge
# ── Named volumes ──────────────────────────────────────────────────────────
volumes:
mlflow_data: # persists MLflow runs/artifacts between restarts
experiments_data: # trained policies shared between train & serve
# ══════════════════════════════════════════════════════════════════════════
services:
# ── 1. MLflow tracking server ──────────────────────────────────────────
mlflow:
image: ghcr.io/mlflow/mlflow:v2.10.0
container_name: food_rescue_mlflow
networks: [rescue_net]
ports:
- "5000:5000"
volumes:
- mlflow_data:/mlruns
command: >
mlflow server
--host 0.0.0.0
--port 5000
--backend-store-uri /mlruns
--default-artifact-root /mlruns
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
interval: 10s
timeout: 5s
retries: 5
# ── 2. Training container (run-once, profile-gated) ────────────────────
train:
profiles: [train]
build:
context: .
dockerfile: Dockerfile.train
container_name: food_rescue_train
networks: [rescue_net]
depends_on:
mlflow:
condition: service_healthy
volumes:
- experiments_data:/app/experiments # persist trained policies
environment:
- CONFIG=${CONFIG:-configs/qlearning_v1.yaml}
- MLFLOW_TRACKING_URI=http://mlflow:5000
# Override CONFIG on the CLI:
# docker compose --profile train run -e CONFIG=configs/dqn_v2_holiday.yaml train
# ── 3. FastAPI inference server (profile-gated) ────────────────────────
serve:
profiles: [serve]
build:
context: .
dockerfile: Dockerfile.serve
container_name: food_rescue_api
networks: [rescue_net]
depends_on:
mlflow:
condition: service_healthy
ports:
- "8000:8000"
volumes:
- experiments_data:/app/experiments # reads trained policies
environment:
- MLFLOW_TRACKING_URI=http://mlflow:5000
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 15s
timeout: 5s
retries: 3