# 3.12+ is required by the pinned scientific stack (numpy 2.5.0 / scipy 1.18.0), # which are the versions that built and serialized models/pipeline.joblib. FROM python:3.12-slim WORKDIR /app # Install dependencies first so the layer caches across code changes. COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the repo (model artifact + app code + metadata). COPY . . # Run as an unprivileged user. RUN useradd --create-home --uid 1000 appuser \ && chown -R appuser:appuser /app USER appuser EXPOSE 7860 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]