# Sanguo VeighNa 基础镜像 # 包含所有 Python 依赖,仅在依赖变更时重建 FROM python:3.11-slim LABEL maintainer="sanguo" LABEL description="Sanguo VeighNa Base Image with all dependencies" # 设置工作目录 WORKDIR /build # 安装系统依赖(编译时需要) RUN apt-get update && apt-get install -y \ gcc g++ make wget \ build-essential \ libssl-dev libffi-dev \ && rm -rf /var/lib/apt/lists/* # 安装 TA-Lib ENV TA_LIBRARY_PATH=/usr/local/lib ENV TA_HEADER_PATH=/usr/include RUN wget -q http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \ tar -xzf ta-lib-0.4.0-src.tar.gz && \ cd ta-lib && \ ./configure --prefix=/usr && \ make && make install && \ cd .. && \ rm -rf ta-lib ta-lib-0.4.0-src.tar.gz # 使用清华镜像加速 ARG PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple ARG PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn ENV PIP_INDEX_URL=${PIP_INDEX_URL} ENV PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST} # CPU 兼容性配置 ENV POLARS_SKIP_CPU_CHECK=1 # 复制依赖文件 COPY requirements-docker.txt . # 安装所有 Python 依赖 # --root-user-action=ignore 抑制 "running as root" 警告 RUN pip install --no-cache-dir --root-user-action=ignore -r requirements-docker.txt # 清理编译工具以减小镜像体积 RUN apt-get purge -y gcc g++ make wget && \ apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* /tmp/* # 设置最终工作目录 WORKDIR /app # 安装 Web 服务基础依赖 RUN pip install --no-cache-dir --root-user-action=ignore uvicorn[standard] fastapi # 元数据标签 LABEL build_date="2025-07-02" LABEL python_version="3.11" LABEL description="Sanguo VeighNa Base - Ready for application layer"