# Model runtime (local builds and reference image)

FROM python:3.11-slim

WORKDIR /app

# Install runtime deps from runtime/pyproject.toml only (avoid busting cache when runtime/Dockerfile changes).
COPY runtime/pyproject.toml /app/runtime/pyproject.toml
COPY .aimp/runtime-wheelhouse/ /opt/aimp/runtime-wheelhouse/
RUN if [ -d /opt/aimp/runtime-wheelhouse ] && ls /opt/aimp/runtime-wheelhouse/*.whl >/dev/null 2>&1; then \
      pip install --no-cache-dir /opt/aimp/runtime-wheelhouse/*.whl && \
      pip install --no-cache-dir /app/runtime; \
    else \
      pip install --no-cache-dir /app/runtime; \
    fi

COPY . .

CMD ["python", "-m", "aimp_sdk.model_runner", "--module", "/app/main.py"]
