Dockerfile 1.03 KB
FROM python:3.11-slim

# 设置系统时区为东八区
ENV TZ=Asia/Shanghai
RUN apt-get update && apt-get install -y --no-install-recommends tzdata && \
    ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
    rm -rf /var/lib/apt/lists/*

# PyPI 镜像加速(清华源)
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple

# 运行时指定 OpenBLAS 使用最通用的内核 (Generic) 以避免 Illegal Instruction
# 之前的 PRESCOTT 可能在某些极其古老或虚拟化的 CPU 上仍有问题
ENV OPENBLAS_CORETYPE=Generic

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 验证关键库是否能正常导入(在构建阶段提前暴露 SIGILL 或 缺失依赖)
RUN python -c "import numpy; print('numpy:', numpy.__version__)"
RUN python -c "import pandas; print('pandas:', pandas.__version__)"
RUN python -c "import pydantic_core; print('pydantic-core OK')"
RUN python -c "import httpx; print('httpx OK')"

COPY . .

EXPOSE 9500

CMD ["python", "main.py"]