FROM python:3.11-slim # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ STREAMLIT_SERVER_PORT=7860 \ STREAMLIT_SERVER_ADDRESS=0.0.0.0 WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Pre-download models to speed up startup and avoid runtime download issues RUN python3 download_models.py # Hugging Face Spaces use port 7860 by default EXPOSE 7860 # Health check to ensure the container is running correctly HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health # Run the application ENTRYPOINT ["streamlit", "run", "multimodal_rag_langgraph_gemini_st.py"]