# 使用官方光源基础镜像
FROM image.sourcefind.cn:5000/dcu/admin/base/custom:vllm0.8.5-ubuntu22.04-dtk25.04.1-rc4-das1.6-py3.10-20250620-fixpy

# 安装基础工具
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    iproute2 \
    dmidecode \
    ipmitool \
    git \
    curl \
    jq \
    lshw \
    iputils-ping \
    pciutils \
    sysstat \
    locate \
    && rm -rf /var/lib/apt/lists/*

# 创建目录结构
RUN mkdir -p /workspace/scripts && \
    mkdir -p /workspace/test/env_check_outputs && \
    mkdir -p /workspace/test/env_check_tools

# 复制脚本并设置权限
COPY ./scripts/run_envcheck.sh /workspace/scripts/
COPY ./env_check_tools/dcu_env_check.zip  /workspace/test/env_check_tools/
COPY ./env_check_tools/rccl-tests.zip  /workspace/test/env_check_tools/

# 验证脚本可执行性
RUN ls -l /workspace/scripts/ && \
    file /workspace/scripts/run_envcheck.sh && \
    head -n 1 /workspace/scripts/run_envcheck.sh  # 检查shebang

# 设置工作目录（建议直接设为脚本目录）
WORKDIR /workspace/scripts/

# 直接执行脚本（无需cd）
CMD bash -c "\
  bash run_envcheck.sh"