31 lines
722 B
Docker
31 lines
722 B
Docker
# Use official lightweight Python image
|
|
FROM python:3.9-slim
|
|
|
|
# Install system dependencies
|
|
# tesseract-ocr: for pytesseract
|
|
# poppler-utils: for pdf2image
|
|
# libtesseract-dev: development headers
|
|
RUN apt-get update && apt-get install -y \
|
|
tesseract-ocr \
|
|
poppler-utils \
|
|
libtesseract-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first to leverage Docker cache
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Expose port (default for Uvicorn)
|
|
EXPOSE 8000
|
|
|
|
# Run the application
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|