# Use Python 3.10 slim image FROM python:3.10-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (better caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Pre-download the model (optional, saves time on first run) RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('paraphrase-MiniLM-L3-v2')" # Copy the rest of the application COPY . . # Create directories RUN mkdir -p uploads document_store # Expose port for HuggingFace EXPOSE 7860 # Set environment variables ENV PYTHONUNBUFFERED=1 ENV FLASK_ENV=production ENV PORT=7860 # Run the application CMD ["python", "app.py"]