Spaces:
Running
Running
| version: "3.9" | |
| # ============================================================ | |
| # Self-Healing ML System — Docker Compose | |
| # ============================================================ | |
| # | |
| # Services: | |
| # api - FastAPI prediction service | |
| # dashboard - Streamlit monitoring dashboard | |
| # mlflow - MLflow tracking server | |
| # | |
| # Usage: | |
| # docker compose up --build | |
| # docker compose up api # API only | |
| # docker compose up dashboard # Dashboard only | |
| services: | |
| # ---------------------------------------------------------- | |
| # ML API (FastAPI) | |
| # ---------------------------------------------------------- | |
| api: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| container_name: self_healing_api | |
| ports: | |
| - "8000:8000" | |
| environment: | |
| - PYTHONUNBUFFERED=1 | |
| - MLFLOW_TRACKING_URI=http://mlflow:5000 | |
| volumes: | |
| - ./data:/app/data # persist model registry + logs | |
| - ./configs:/app/configs # live config changes | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:8000/health"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 30s | |
| restart: unless-stopped | |
| networks: | |
| - self_healing_net | |
| # ---------------------------------------------------------- | |
| # Streamlit Dashboard | |
| # ---------------------------------------------------------- | |
| dashboard: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile.dashboard | |
| container_name: self_healing_dashboard | |
| ports: | |
| - "8501:8501" | |
| environment: | |
| - API_URL=http://api:8000 | |
| volumes: | |
| - ./data:/app/data | |
| depends_on: | |
| api: | |
| condition: service_healthy | |
| restart: unless-stopped | |
| networks: | |
| - self_healing_net | |
| # ---------------------------------------------------------- | |
| # MLflow Tracking Server | |
| # ---------------------------------------------------------- | |
| mlflow: | |
| image: ghcr.io/mlflow/mlflow:v2.12.1 | |
| container_name: self_healing_mlflow | |
| ports: | |
| - "5000:5000" | |
| volumes: | |
| - ./data/mlruns:/mlflow/mlruns | |
| command: > | |
| mlflow server | |
| --host 0.0.0.0 | |
| --port 5000 | |
| --backend-store-uri /mlflow/mlruns | |
| --default-artifact-root /mlflow/mlruns/artifacts | |
| restart: unless-stopped | |
| networks: | |
| - self_healing_net | |
| networks: | |
| self_healing_net: | |
| driver: bridge | |
| volumes: | |
| data: | |