# 基础镜像 FROM python:3.10 # 设置阿里云的Debian镜像源并安装系统依赖和中文字体 RUN rm -f /etc/apt/sources.list /etc/apt/sources.list.d/* \ && echo "deb https://mirrors.aliyun.com/debian/ bookworm main" > /etc/apt/sources.list \ && echo "deb https://mirrors.aliyun.com/debian/ bookworm-updates main" >> /etc/apt/sources.list \ && apt-get update && apt-get install -y --no-install-recommends \ fonts-wqy-zenhei \ fonts-wqy-microhei \ ttf-wqy-zenhei \ ttf-wqy-microhei \ # 清理 apt 缓存 && apt-get clean && rm -rf /var/lib/apt/lists/* # 设置清华大学的pip镜像源 RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple # 设置容器工作目录 WORKDIR /app # 复制依赖文件 COPY requirements.txt . # 安装依赖 # taospy 可能会在 aarch64 架构的机器上(如M1/M2 Mac)安装失败,如果遇到问题可以尝试注释掉 RUN pip3 install taospy && \ pip3 install --no-cache-dir -r requirements.txt # 复制 td_analysis 源代码到工作目录 COPY src/td_analysis /app/src/td_analysis # 暴露端口 EXPOSE 5002 # 容器启动时运行Python脚本 CMD ["python3", "-u", "src/td_analysis/td_analyzer.py"]