# ============================================================ # AllyCat – Flask Graph + RAG (Cloud / Local optional) # Hugging Face Spaces–ready Dockerfile # ============================================================ FROM python:3.11-slim # --- Build args for optional features ----------------------- ARG INSTALL_OLLAMA=false ARG INSTALL_LOCAL_VECTOR_DB=false # --- Workdir & environment ---------------------------------- WORKDIR /allycat ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ LLM_RUN_ENV=cloud \ VECTOR_DB_TYPE=cloud_zilliz \ HF_SPACE=true # --- Base system deps --------------------------------------- RUN apt-get update && apt-get install -y --no-install-recommends \ bash curl git netcat-traditional dos2unix \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # --- Python deps -------------------------------------------- COPY requirements-docker-cloud.txt . RUN pip install --no-cache-dir -r requirements-docker-cloud.txt # --- Conditional installs ----------------------------------- RUN if [ "$INSTALL_OLLAMA" = "true" ]; then \ echo "Installing Ollama (local LLM mode)"; \ curl -fsSL https://ollama.com/install.sh | sh; \ else \ echo "Skipping Ollama – using cloud LLM mode"; \ fi RUN if [ "$INSTALL_LOCAL_VECTOR_DB" = "true" ]; then \ echo "Installing Milvus-lite (local vector DB)"; \ pip install --no-cache-dir milvus-lite==2.4.11; \ else \ echo "Skipping local vector DB – using Zilliz Cloud"; \ fi # --- Copy project files ------------------------------------- COPY . . RUN dos2unix docker-startup.sh && chmod +x docker-startup.sh # --- Clean temporary files ---------------------------------- RUN rm -rf __pycache__ *.pyc # --- Port & startup (Hugging Face exposes 7860) ------------- EXPOSE 7860 CMD bash -c "\ echo '🚀 Starting AllyCat on Hugging Face...'; \ if [ -f ./docker-startup.sh ]; then \ ./docker-startup.sh deploy; \ else \ python app_flask_graph.py; \ fi"