# Use Ubuntu base for better compatibility FROM ubuntu:22.04 # Set environment variables to avoid interactive prompts ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC # Install Python and essential dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ python3.10 \ python3-pip \ python3.10-venv \ curl \ wget \ && rm -rf /var/lib/apt/lists/* # Install PDF processing dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ poppler-utils \ tesseract-ocr \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy requirements first for better caching COPY requirements.txt . RUN pip3 install --no-cache-dir --upgrade pip && \ pip3 install --no-cache-dir -r requirements.txt # Download embedding model (small version) RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" # Copy application code COPY . . # Create necessary directories RUN mkdir -p data/documents data/chroma_db data/uploads logs # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONPATH=/app ENV STREAMLIT_SERVER_PORT=7860 ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 # Expose port EXPOSE 7860 # Run the application CMD ["streamlit", "run", "app.py", \ "--server.port=7860", \ "--server.address=0.0.0.0", \ "--server.headless=true", \ "--browser.gatherUsageStats=false", \ "--server.enableXsrfProtection=false", \ "--server.enableCORS=false"]