FROM python:3.10-slim # Install system dependencies for OpenCV RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ libsm6 \ libxext6 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /code # Set cache directories ENV DOCTR_CACHE_DIR="/code/.cache/doctr" ENV HF_HOME="/code/.cache/huggingface" # Create and set permissions for cache directories RUN mkdir -p /code/.cache/doctr /code/.cache/huggingface && \ chmod 777 -R /code/.cache # Copy and install requirements COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # Expose port EXPOSE 7860 # Run the Flask+Gradio app CMD ["python", "app.py"]