PhysicsCorrection/assets/Dockerfile.fixed

52 lines
1.7 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM registry-vpc.cn-chengdu.aliyuncs.com/zhixueli-prod/python:3.12-slim
WORKDIR /app
# 设置国内镜像源
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
# 安装系统依赖(精简版)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
make \
pkg-config \
libglib2.0-dev \
libcairo2-dev \
libxml2-dev \
libxslt1-dev \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# 设置 pip 国内镜像源和 API 端点
ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
PIP_TRUSTED_HOST=mirrors.aliyun.com \
# API 端点配置
COZE_INTEGRATION_BASE_URL=https://api.coze.cn/v1 \
COZE_INTEGRATION_MODEL_BASE_URL=https://api.coze.cn/v1 \
COZE_INTEGRATION_CHAT_BASE_URL=https://api.coze.cn/v1 \
# ✅ 关键修复:只保留一个 API_KEY使用环境变量注入
# COZE_API_KEY 将在运行时通过 docker-compose.yml 注入
# ✅ 关键修复:添加 WORKSPACE_ID必须
# COZE_WORKSPACE_ID 将在运行时通过 docker-compose.yml 注入
LLM_MODEL_NAME=doubao-seed-2-0-pro-260215
# 升级 pip 和构建工具
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# 复制并安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制项目文件
COPY . .
# 添加健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
EXPOSE 8000
CMD ["python", "src/main.py", "-m", "http", "-p", "8000"]