Dockerfile 838 Bytes
FROM python:3.11-slim

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

# 运行时指定 OpenBLAS 使用兼容内核
ENV OPENBLAS_CORETYPE=PRESCOTT

WORKDIR /app

# 安装编译工具链(numpy 源码编译必需)
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc g++ gfortran libopenblas-dev liblapack-dev \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
# 从源码编译 numpy:基线 SSE3(此 CPU 支持),禁止 dispatch 到 SSSE3+
RUN pip install --no-cache-dir --no-binary=numpy numpy==1.26.4 \
    -Csetup-args=-Dcpu-baseline=sse3 \
    -Csetup-args=-Dcpu-dispatch=none
RUN pip install --no-cache-dir -r requirements.txt
RUN python -c "import numpy; print('numpy:', numpy.__version__)"

COPY . .

EXPOSE 9500

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