FROM python:3.11-slim # HF Spaces Docker requirement: app must run as non-root user 1000 RUN useradd -m -u 1000 user WORKDIR /app # Install system deps for SQLite and build tools RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY --chown=user:user app.py . COPY --chown=user:user data/ ./data/ USER user EXPOSE 7860 CMD ["python", "app.py"]