File size: 1,173 Bytes
e95e29f
3e7e287
9e7f5a4
f56ceca
 
 
 
 
 
 
 
e95e29f
9e7f5a4
 
e95e29f
 
9e7f5a4
 
e95e29f
3e7e287
13a37a9
e95e29f
3e7e287
e95e29f
13a37a9
e95e29f
23a9a72
e95e29f
23a9a72
e95e29f
3e7e287
13a37a9
e95e29f
 
 
 
 
 
 
 
 
f56ceca
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
# ---------- Base ----------
FROM python:3.11-slim

# ---------- Environment Setup ----------
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV HF_HOME=/code/.cache/huggingface
ENV TRANSFORMERS_CACHE=/code/.cache/huggingface
ENV TORCH_HOME=/code/.cache/torch

# ---------- System Dependencies ----------
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    wget \
    && rm -rf /var/lib/apt/lists/*

# ---------- Working Directory ----------
WORKDIR /code

# ---------- Install Python Dependencies ----------
COPY requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt

# ---------- Pre-Download Embedding Model ----------
COPY pre_download.py .
RUN python pre_download.py

# ---------- Copy Application Code ----------
COPY . .

# ---------- Ensure FAISS and Cache Dirs Exist ----------
RUN mkdir -p /code/faiss_db /code/.cache && chmod -R 777 /code/faiss_db /code/.cache

# ---------- Expose Web Port ----------
EXPOSE 7860

# ---------- Start the App ----------
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:7860", "--timeout", "300"]