FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y \ tesseract-ocr \ poppler-utils \ libgl1 \ libglib2.0-0 \ && 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 the rest of the application COPY . . # Create necessary directories with proper permissions for HF Spaces RUN mkdir -p /app/app/storage/chroma_db \ /app/app/uploads \ /app/app/tmp \ /app/app/highlighted \ /app/app/charts \ /app/app/tables \ /app/app/cache \ && chmod -R 777 /app/app/storage \ && chmod -R 777 /app/app/uploads \ && chmod -R 777 /app/app/tmp \ && chmod -R 777 /app/app/highlighted \ && chmod -R 777 /app/app/charts \ && chmod -R 777 /app/app/tables \ && chmod -R 777 /app/app/cache # Expose port (HF Spaces uses 7860) EXPOSE 7860 # Run the application CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]