File size: 1,016 Bytes
19073ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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"]