43 lines
846 B
Docker
43 lines
846 B
Docker
FROM python:3.11-slim
|
|
|
|
# Install system dependencies for Pillow and Tesseract
|
|
RUN apt-get update && apt-get install -y \
|
|
tesseract-ocr \
|
|
libtesseract-dev \
|
|
libfreetype6-dev \
|
|
libjpeg-dev \
|
|
libpng-dev \
|
|
fonts-dejavu \
|
|
fonts-dejavu-core \
|
|
fonts-dejavu-extra \
|
|
fonts-liberation \
|
|
fonts-liberation2 \
|
|
fontconfig \
|
|
&& fc-cache -f -v \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application files
|
|
COPY app.py .
|
|
COPY templates/ templates/
|
|
|
|
# Create uploads directory
|
|
RUN mkdir -p uploads
|
|
|
|
# Expose port
|
|
EXPOSE 5001
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Run the application
|
|
CMD ["python", "app.py"]
|