services: mlflow-server: build: context: . dockerfile: Dockerfile.mlflow-server ports: - "8000:8000" volumes: # Mount the database file and artifacts directory to persist them - ./mlflow.db:/app/mlflow.db - ./mlartifacts:/app/mlartifacts restart: unless-stopped model-serve: build: context: . dockerfile: Dockerfile.model-serve ports: - "5001:5001" environment: # Points to the service name defined above, not localhost - MLFLOW_TRACKING_URI=http://mlflow-server:8000 # You can override this at runtime: docker compose run -e MODEL_URI="..." model-serve - MODEL_URI=${MODEL_URI:-models:/Autoencoder_Anomaly_Detector/2} volumes: # Crucial: Since MLflow is using a local disk artifact store, # the server passes local file paths back to the client. # The serving container must have access to the exact same artifact paths. - ./mlartifacts:/app/mlartifacts depends_on: - mlflow-server restart: unless-stopped