FROM python:3.13-slim # HF Spaces runs containers as UID 1000 RUN useradd -m -u 1000 user WORKDIR /app # Install dependencies (cached layer) COPY requirements.txt . RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt # Copy application source COPY --chown=user:user . . # Ensure the stats file location is writable at runtime RUN mkdir -p storyscope/data && chown -R user:user storyscope/data USER user EXPOSE 7860 # TRUST_PROXY=true because HF Spaces sits behind a reverse proxy ENV TRUST_PROXY=true ENV PORT=7860 CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]