# ZeroGPU Dockerfile for HF Spaces Pro - FIXED VERSION FROM python:3.9-slim # Set environment variables ENV PYTHONUNBUFFERED=1 ENV DEBIAN_FRONTEND=noninteractive # Install system dependencies RUN apt-get update && apt-get install -y \ git \ wget \ curl \ build-essential \ && rm -rf /var/lib/apt/lists/* # Create user (required for HF Spaces) RUN useradd -m -u 1000 user WORKDIR /app # Upgrade pip first RUN pip install --upgrade pip # Install packages INDIVIDUALLY to catch errors RUN pip install --no-cache-dir gradio==4.44.0 RUN pip install --no-cache-dir spaces RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 RUN pip install --no-cache-dir transformers==4.48.2 RUN pip install --no-cache-dir sentence-transformers RUN pip install --no-cache-dir python-docx RUN pip install --no-cache-dir pymupdf RUN pip install --no-cache-dir unstructured RUN pip install --no-cache-dir sqlite-utils RUN pip install --no-cache-dir pandas RUN pip install --no-cache-dir numpy RUN pip install --no-cache-dir huggingface_hub RUN pip install --no-cache-dir accelerate # Install PyLate LAST (it's finicky) RUN pip install --no-cache-dir pylate==1.2.0 # Copy requirements file (as backup) COPY --chown=user requirements.txt . # Copy application code COPY --chown=user . . # Switch to user USER user # Set environment variables for user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Expose port EXPOSE 7860 # Command to run the application CMD ["python3", "app.py"]