35 lines
893 B
Docker
35 lines
893 B
Docker
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装系统依赖
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 安装Python依赖
|
|
RUN pip install --no-cache-dir \
|
|
fastapi==0.109.0 \
|
|
uvicorn[standard]==0.27.0 \
|
|
pydantic==2.5.3 \
|
|
langchain==0.1.0 \
|
|
langchain-community==0.0.10 \
|
|
litellm==1.17.0 \
|
|
azure-storage-blob==12.19.0 \
|
|
azure-identity==1.15.0
|
|
|
|
# 复制agent代码
|
|
COPY azure_blob_agent.py .
|
|
|
|
# 设置环境变量
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV SERVICE_HOST=0.0.0.0
|
|
ENV SERVICE_PORT=8080
|
|
|
|
# 健康检查 - 使用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", "azure_blob_agent.py"]
|