vn6295337's picture
Fix libgl package name for Debian Trixie
3a9dfa1
raw
history blame contribute delete
927 Bytes
FROM python:3.11-slim
# Install system dependencies for Docling (PDF, OCR, image processing)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Create user for HF Spaces (runs as user ID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy requirements and install dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user src/ ./src/
# Expose port (HF Spaces uses 7860)
EXPOSE 7860
# Run FastAPI with uvicorn
CMD ["uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "7860"]