# SparkyUI Model Manager - StabilityMatrix-style model download/management UI
# Lightweight FastAPI service. Downloads land in the shared host models/ folder
# (mounted read-write here, read-only in the ComfyUI container).
FROM python:3.12-slim

LABEL maintainer="SparkyUI"
LABEL description="Model Manager for ComfyUI on DGX Spark"

WORKDIR /app

# curl is used by the healthcheck.
RUN apt-get update && apt-get install -y --no-install-recommends curl \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY app ./app

ENV MODELS_DIR=/models \
    DATA_DIR=/data

EXPOSE 8189

HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:8189/api/model-types || exit 1

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8189"]
