44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
# A2A LiteLLM Agent Dockerfile
|
|
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装系统依赖
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 复制依赖文件
|
|
COPY agents/a2a_litellm_agent/requirements.txt .
|
|
|
|
# 安装Python依赖
|
|
RUN pip install --no-cache-dir -r requirements.txt requests
|
|
|
|
# 复制 common 模块(回调工具)
|
|
COPY common/agent_callback_utils.py /app/common/
|
|
RUN touch /app/common/__init__.py
|
|
|
|
# 复制应用代码
|
|
COPY agents/a2a_litellm_agent/*.py /app/
|
|
|
|
# 设置环境变量
|
|
ENV SERVICE_HOST=0.0.0.0
|
|
ENV SERVICE_PORT=8080
|
|
ENV POD_NAME=a2a-litellm-agent
|
|
ENV TEMPLATE_TYPE=a2a_litellm_agent
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# 回调配置
|
|
ENV AGENT_CALLBACK_URL=http://mcp-server.taiji-ai.svc.cluster.local:8002/api/v1/billing/agent-callback
|
|
|
|
# 健康检查
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health').read()" || exit 1
|
|
|
|
# 暴露端口
|
|
EXPOSE 8080
|
|
|
|
# 启动命令
|
|
CMD ["python", "main.py"]
|