feat: add ML service scaffolding with Python FastAPI, Docker, and MLflow setup

This commit is contained in:
Marko Djordjevic 2026-02-15 11:58:31 +01:00
parent 92abab5316
commit 1a653c5866
18 changed files with 1952 additions and 2593 deletions

View file

@ -5,9 +5,74 @@ services:
- "3000:3000"
volumes:
- candle-data:/app/data
- ml-data:/app/ml-data
environment:
- NODE_ENV=production
- INFERENCE_API_URL=http://ml-service:8001
- INFERENCE_API_TIMEOUT=30000
- INFERENCE_BATCH_TIMEOUT=120000
- NEXT_PUBLIC_PREDICTIONS_ENABLED=true
restart: unless-stopped
depends_on:
- ml-service
ml-service:
build: ./services/ml
ports:
- "8001:8001"
volumes:
- ml-data:/app/data
- mlflow-data:/app/mlruns
environment:
- MLFLOW_TRACKING_URI=http://mlflow:5000
- DATABASE_URL=postgresql://ml_user:ml_password@postgres:5432/ml_db
- PYTHONUNBUFFERED=1
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
mlflow:
condition: service_started
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
mlflow:
image: ghcr.io/mlflow/mlflow:v2.10.0
ports:
- "5000:5000"
volumes:
- mlflow-data:/mlflow
command: >
mlflow server
--backend-store-uri /mlflow
--default-artifact-root /mlflow/artifacts
--host 0.0.0.0
--port 5000
restart: unless-stopped
postgres:
image: postgres:16-alpine
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=ml_user
- POSTGRES_PASSWORD=ml_password
- POSTGRES_DB=ml_db
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ml_user -d ml_db"]
interval: 10s
timeout: 5s
retries: 5
volumes:
candle-data:
ml-data:
mlflow-data:
postgres-data: