FROM python:3.11-slim # Metadata LABEL maintainer="multi-doc-rag" LABEL description="Multi-Document RAG System - Slim build, no GPU/torch" # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV PIP_NO_CACHE_DIR=1 # Install system dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements first for Docker layer caching COPY requirements.txt . # Install Python dependencies (NO torch, NO transformers) RUN pip install --no-cache-dir -r requirements.txt && \ pip uninstall -y torch torchvision torchaudio transformers sentence-transformers 2>/dev/null || true # Create upload, evaluation, and log directories with full read/write permissions # (Crucial for Hugging Face Spaces which runs under user ID 1000) RUN mkdir -p /app/data/uploads /app/evaluation/reports /app/logs && \ chmod -R 777 /app/data /app/evaluation /app/logs # Copy application code COPY . . # Make the start script executable RUN chmod +x /app/start.sh # Expose the default web port (7860 for Hugging Face, 10000 for Render) EXPOSE 7860 # Run the backend & frontend supervisor script CMD ["./start.sh"]