FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app ./app COPY static ./static # Hugging Face Spaces (Docker SDK) sends traffic to port 7860 and runs the # container as a non-root user, so make sure /app is writable by everyone. RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app USER appuser EXPOSE 7860 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]