FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* # Install Ollama RUN curl -fsSL https://ollama.com/install.sh | sh # Set working directory WORKDIR /app # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . RUN chmod +x start.sh # Set environment variables for Ollama ENV OLLAMA_HOST=0.0.0.0:11434 ENV OLLAMA_ORIGINS=* ENV OLLAMA_KEEP_ALIVE=5m # Expose port 7860 (required by Hugging Face Spaces) EXPOSE 7860 # Start the application CMD ["/app/start.sh"]