diff --git a/Dockerfile b/Dockerfile index 106f838..ad093e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.11-slim # Install system dependencies for Pillow and Tesseract -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ tesseract-ocr \ libtesseract-dev \ libfreetype6-dev \ @@ -18,7 +18,7 @@ RUN apt-get update && apt-get install -y \ wget \ unzip \ git \ - && fc-cache -f -v \ + ca-certificates \ && rm -rf /var/lib/apt/lists/* # Download and install select Google Fonts from GitHub @@ -60,8 +60,9 @@ WORKDIR /app # Copy requirements first for better caching COPY requirements.txt . -# Install Python dependencies -RUN pip install --no-cache-dir -r requirements.txt +# Install Python dependencies and clear cache +RUN pip install --no-cache-dir -r requirements.txt && \ + rm -rf /root/.cache/pip # Copy application files COPY app.py . @@ -76,5 +77,5 @@ EXPOSE 5001 # Set environment variables ENV PYTHONUNBUFFERED=1 -# Run the application -CMD ["python", "app.py"] +# Run the application with Gunicorn +CMD ["gunicorn", "--bind", "0.0.0.0:5001", "--workers", "4", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "app:app"]