# Dockerfile for HuggingFace Spaces - DeepSeek-OCR Service # Based on: https://huggingface.co/docs/hub/spaces-sdks-docker FROM python:3.9-slim # Install system dependencies for building Python packages RUN apt-get update && apt-get install -y \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Create user with ID 1000 (required by HuggingFace Spaces) RUN useradd -m -u 1000 user # Switch to user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set working directory WORKDIR /home/user/app # Upgrade pip first RUN pip install --no-cache-dir --upgrade pip # Copy requirements and install dependencies COPY --chown=user requirements.txt requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY --chown=user . /home/user/app # Expose port 7860 (required by HuggingFace Spaces) EXPOSE 7860 # Run the FastAPI application via app.py CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]