File size: 614 Bytes
ad74240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73801d9
 
 
 
ad74240
 
 
 
 
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
FROM python:3.10-slim

WORKDIR /app

# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# 安装 Python 依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 复制应用代码
COPY . .

# 确保目录存在(/data 为 HF Spaces 持久存储)
RUN mkdir -p static /data/agents /data/uploads

ENV DATA_DIR=/data

EXPOSE 7860

# 使用 gunicorn 运行,支持 SSE 流式输出
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--threads", "4", "--timeout", "120", "app:app"]