File size: 824 Bytes
6ed9254
a8fa967
 
6ed9254
a8fa967
 
db13db1
 
a8fa967
db13db1
a8fa967
 
 
6ed9254
a8fa967
 
 
6ed9254
a8fa967
 
6ed9254
a8fa967
 
6ed9254
 
 
 
a8fa967
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
# Use Python 3.9
FROM python:3.9-slim

# Set the working directory
WORKDIR /app

# Install system dependencies
# FIX: Replaced 'libgl1-mesa-glx' with 'libgl1' and 'libglx-mesa0'
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install them
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Pre-download the English model so it doesn't download on every startup
RUN python -c "import easyocr; easyocr.Reader(['en'], gpu=False)"

# Copy your code into the container
COPY . .

# Create a writable directory for temporary uploads (Crucial for Spaces)
RUN mkdir -p /app/temp && chmod 777 /app/temp

# Run the app on port 7860 (Hugging Face default)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]