FROM python:3.12-slim WORKDIR /app ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Run as a non-root user (HF recommends uid 1000). data/ must stay writable: the pick # panels and the risk screen cache there (ephemeral — a restart just recomputes). RUN useradd -m -u 1000 app COPY --chown=app:app . . USER app # HF Spaces serve on 7860 EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]