Files
taiji-AI-PAD/services/model-gateway/Dockerfile
T
xiaohei 456bdaec8b feat: 配置OpenRouter和RapidAPI密钥管理
- 统一密钥管理:创建 .env 文件集中管理所有API密钥
- 添加 OpenRouter 支持:配置 GPT-4o-mini 和 Claude 3.5 Sonnet 模型
- 添加 RapidAPI 支持:配置数据接入服务的 RapidAPI Key
- 修复 LiteLLM Prisma 兼容性:降级到 Prisma 5.8.0
- 修复模型 ID:更正 Claude 模型 ID 为 claude-3.5-sonnet
- 优化配置:调整 max_tokens 参数避免超限
- 文档更新:添加环境变量配置说明文档

测试状态:
- Claude 3.5 Sonnet: ✅ 正常
- GPT-4o-mini: ✅ 正常
- Data Ingestion: ✅ 正常
2025-12-21 15:20:21 +00:00

52 lines
1.8 KiB
Docker

FROM python:3.11-slim
# 设置工作目录
WORKDIR /app
# 安装系统依赖 (使用阿里云镜像源加速)
RUN rm -rf /etc/apt/sources.list.d/debian.sources && \
echo "deb http://mirrors.aliyun.com/debian trixie main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian trixie-updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian-security trixie-security main contrib non-free" >> /etc/apt/sources.list && \
apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# 安装Node.js (prisma需要) 使用阿里云源
RUN apt-get update && apt-get install -y \
nodejs npm \
&& rm -rf /var/lib/apt/lists/* && \
npm config set registry https://registry.npmmirror.com
# 安装LiteLLM和prisma (使用国内源)
# 注意:Prisma Python 客户端 0.12.0 需要 Prisma CLI 5.8.0
# 需要同时安装 Prisma CLI 和 Python 客户端
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple \
litellm[proxy]==1.17.0 \
redis==5.0.1 \
prometheus-client==0.19.0 \
prisma==0.12.0 && \
(rm -f /usr/local/bin/prisma || true) && \
npm install -g prisma@5.8.0
# 复制配置文件
COPY config/ ./config/
# 创建logs目录
RUN mkdir -p logs
# 设置环境变量
ENV LITELLM_MASTER_KEY=sk-taiji-master-key
ENV LITELLM_CONFIG_PATH=/app/config/litellm.yaml
# 暴露端口
EXPOSE 4000
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:4000/health || exit 1
# 启动LiteLLM代理
CMD ["litellm", "--config", "/app/config/litellm_simple.yaml", "--port", "4000", "--host", "0.0.0.0"]