# Use a more compatible base image with GL support FROM python:3.9-slim-bullseye # Set the working directory in the container WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ tesseract-ocr \ poppler-utils \ libgl1 \ && rm -rf /var/lib/apt/lists/* # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ FLASK_APP=app_hf_clean.py \ FLASK_ENV=production \ PYTHONPATH=/app # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create necessary directories with proper permissions RUN mkdir -p /tmp/uploads && \ chmod -R a+rwx /app && \ chmod -R a+rwx /tmp/uploads # Expose the port the app runs on EXPOSE 7860 # Set the user to a non-root user RUN useradd -m myuser && chown -R myuser:myuser /app USER myuser # Command to run the application CMD ["python", "app_hf_clean.py"]