upi-parser-api / Dockerfile
Tudu-Dev's picture
Update Dockerfile
db13db1 verified
raw
history blame contribute delete
824 Bytes
# 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"]