# Hugging Face Spaces-compatible image (SDK: docker, app_port: 8000). FROM python:3.12-slim # pikepdf needs QPDF; lxml needs libxml2/libxslt. Installed as root at build. RUN apt-get update \ && apt-get install -y --no-install-recommends \ qpdf \ libxml2 \ libxslt1.1 \ && rm -rf /var/lib/apt/lists/* # Run as a non-root user (Hugging Face Spaces best practice). RUN useradd -m -u 1000 user WORKDIR /app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt COPY --chown=user backend ./backend COPY --chown=user frontend ./frontend COPY --chown=user tools ./tools USER user EXPOSE 8000 CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]