File size: 2,225 Bytes
b598862
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ───────────────────────────────
# 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"]