# ─────────────────────────────── # 1️⃣ Base image # ─────────────────────────────── FROM python:3.10-slim # ─────────────────────────────── # 2️⃣ Environment variables (important for HF & Transformers) # ─────────────────────────────── ENV PYTHONUNBUFFERED=1 \ TOKENIZERS_PARALLELISM=false \ TRANSFORMERS_CACHE=/tmp/transformers \ HF_HOME=/tmp/huggingface \ SENTENCE_TRANSFORMERS_HOME=/tmp/sentence_transformers \ TORCH_HOME=/tmp/torch \ PORT=7860 # ─────────────────────────────── # 3️⃣ System dependencies # ─────────────────────────────── RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ curl \ && rm -rf /var/lib/apt/lists/* # ─────────────────────────────── # 4️⃣ Copy project files # ─────────────────────────────── WORKDIR /app COPY requirements.txt /app/ COPY app.py /app/ COPY agent_langchain.py /app/ # ─────────────────────────────── # 5️⃣ Install Python dependencies # ─────────────────────────────── RUN pip install --no-cache-dir -r requirements.txt # ─────────────────────────────── # 6️⃣ Expose Hugging Face Space port # ─────────────────────────────── EXPOSE 7860 # ─────────────────────────────── # 7️⃣ Launch FastAPI app # ─────────────────────────────── CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]