FROM python:3.11-slim # HF Spaces runs containers as uid 1000 RUN useradd -m -u 1000 appuser WORKDIR /app # Install deps as root COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy app source COPY --chown=appuser:appuser . . USER appuser # HF Spaces default port EXPOSE 7860 ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 # Run FastAPI via uvicorn — serves both the API and index.html CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]