FROM python:3.11 WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ tesseract-ocr \ poppler-utils \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install -r requirements.txt COPY . . # Create writable directories with proper permissions RUN mkdir -p /app/data && chmod -R 777 /app/data RUN mkdir -p /app/static && chmod -R 777 /app/static RUN mkdir -p /app/uploads && chmod -R 777 /app/uploads RUN mkdir -p /app/clip_cache && chmod -R 777 /app/clip_cache RUN mkdir -p /app/logs && chmod -R 777 /app/logs # Set environment variables for cache directories ENV CLIP_CACHE=/app/clip_cache ENV HF_HOME=/app/clip_cache ENV TORCH_HOME=/app/clip_cache EXPOSE 7860 CMD ["python", "app.py"]