# Python 分析服务 Dockerfile
FROM python:3.12-slim

WORKDIR /app

# 配置国内镜像源（pip + apt）
RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources && \
    pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
    pip config set global.trusted-host mirrors.aliyun.com

# 安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 复制源代码
COPY . .

# 暴露端口
EXPOSE 8001

# 健康检查需要 curl
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

# 启动服务
CMD ["python", "server.py"]
