Files
membank/auto-check/docker/stress-test/Dockerfile
张威33321 a8fa159f0f chore: 同步本地更改
- 新增 aio-mcp 项目框架
- 新增 .trae/skills/ OCR/SKU 设计工具
- 更新 auto-check 配置和 stress 包
- 删除 fnhelp 文档目录
- 更新 Docker 压力测试脚本
2026-08-27 20:38:13 +08:00

69 lines
2.6 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 压力测试工具镜像
#
# 用途:为 auto-check 提供预装压测工具与脚本的容器环境
# 优势:工具预装在镜像中,无需在目标机在线安装,环境一致性好
#
# 工作流程(固定分发模式,不依赖 registry
# 1. auto-check 检测目标机器的 Docker 可用性
# 2. 目标机无镜像时,上传工程目录中导出的 tardocker save并 docker load
# 3. 启动容器执行测试(脚本已打包在镜像中,挂载 /sys 采集温度)
# 4. 收集测试结果并解析
#
# 构建与导出(推荐用脚本,自动时间戳 tag
# cd docker/stress-test
# ./build.sh # 自动用当前时间戳打 tag
# ./build.sh 20260824-153045 # 或手动指定
# 脚本会同时:构建镜像(时间戳 tag) + 导出 tar + 同步 auto-check.yaml 配置
#
# 手动构建(如绕过脚本):
# cd docker/stress-test
# docker build -t stress-test:<时间戳> .
# docker save -o stress-test.tar stress-test:<时间戳>
# # 同步修改 ../../auto-check.yaml 的 docker_image
#
# 使用方式(在 auto-check.yaml 中配置):
# stress:
# docker_image: "stress-test:<时间戳>"
# docker_tar: "docker/stress-test/stress-test.tar"
FROM debian:12-slim
# UTF-8 locale保证 sensors 输出带 ° 符号的温度格式(脚本正则依赖)
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
# 清理缓存,减少镜像体积
# - python3/python3-psutil/memtester/stress/sudofnscript 稳定性门禁的依赖
# self_inspection.py 调 psutil 计算测试内存、sudo memtester 做数据校验、
# stress 做 CPU 压测;脚本原样收录在 vendor/fnscript/,源码不做修改)
RUN apt-get update && apt-get install -y --no-install-recommends \
stress-ng \
fio \
lm-sensors \
sysstat \
procps \
python3 \
python3-psutil \
memtester \
stress \
sudo \
&& rm -rf /var/lib/apt/lists/*
# 验证工具安装
RUN stress-ng --version && fio --version && sensors --version \
&& python3 -c "import psutil; print('psutil', psutil.__version__)" \
&& command -v memtester && command -v stress && command -v sudo
# 复制测试脚本到镜像中
COPY scripts/ /scripts/
# fnscript 稳定性测试脚本(社区脚本 vendor 收录,源码不改,见 vendor/fnscript/README.md
COPY vendor/fnscript/script/self_inspection.py /vendor/fnscript/self_inspection.py
COPY vendor/fnscript/LICENSE /vendor/fnscript/LICENSE
# 设置脚本执行权限
RUN chmod +x /scripts/*.sh
WORKDIR /tmp
# 默认执行入口(由 auto-check 传入脚本参数)
ENTRYPOINT ["/bin/bash", "/scripts/run.sh"]