44 lines
1.3 KiB
Docker
44 lines
1.3 KiB
Docker
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装系统依赖
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 复制requirements文件
|
|
COPY agents/search_agent/search_agent/requirements.txt /app/search_agent_requirements.txt
|
|
|
|
# 安装Python依赖
|
|
RUN pip install --no-cache-dir \
|
|
fastapi==0.109.0 \
|
|
uvicorn[standard]==0.27.0 \
|
|
pydantic==2.5.3 \
|
|
&& pip install --no-cache-dir -r /app/search_agent_requirements.txt
|
|
|
|
# 复制search_agent目录
|
|
COPY agents/search_agent/search_agent/ /app/search_agent/
|
|
|
|
# 复制主agent文件和共享工具
|
|
COPY agents/search_agent/search_agent_main.py /app/
|
|
COPY common/agent_callback_utils.py /app/common/
|
|
COPY common/api_key_utils.py /app/common/
|
|
|
|
# 设置环境变量
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV SERVICE_HOST=0.0.0.0
|
|
ENV SERVICE_PORT=8080
|
|
ENV PYTHONPATH=/app
|
|
|
|
# 默认 API 密钥(硬编码)
|
|
ENV JINA_API_KEY=jina_e26dc30420a44a1e859216528065b203TkMRmsoz-FgMDQC5FZX9jr5oF2CI
|
|
ENV SERPER_API_KEY=8253b4f240b520194065312f90e85f9be0fa205f
|
|
|
|
# 健康检查 - 使用Python避免僵尸进程
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health').read()" || exit 1
|
|
|
|
# 运行agent (直接使用Python,避免shell)
|
|
CMD ["python3", "-u", "search_agent_main.py"]
|