This commit is contained in:
2026-03-15 22:56:20 +08:00
parent 64e9dcc74a
commit 3255c5adb3
+20 -4
View File
@@ -46,10 +46,26 @@ RUN dnf -y install --setopt=install_weak_deps=False --nodocs \
WORKDIR /tmp
ARG ROCM_MAJOR_VER=7
ARG GFX=gfx120X-all
COPY therock.tar.gz /tmp/therock.tar.gz
RUN mkdir -p /opt/rocm && \
tar xzf therock.tar.gz -C /opt/rocm --strip-components=1 && \
rm therock.tar.gz
# 智能处理:如果 build context 里有 therock.tar.gz 就用本地的,没有就从网络拉取
# 注意:Dockerfile 的 COPY 无法直接做条件判断,我们通过 shell 逻辑处理
RUN set -euo pipefail; \
if [ -f "therock.tar.gz" ]; then \
echo "Using local therock.tar.gz from build context."; \
else \
echo "Local SDK not found, downloading from remote..."; \
BASE="https://therock-nightly-tarball.s3.amazonaws.com"; \
PREFIX="therock-dist-linux-${GFX}-${ROCM_MAJOR_VER}"; \
KEY="$(maybe_proxy curl -s "${BASE}?list-type=2&prefix=${PREFIX}" \
| tr '<' '\n' \
| grep -o "therock-dist-linux-${GFX}-${ROCM_MAJOR_VER}\..*\.tar\.gz" \
| sort -V | tail -n1)"; \
echo "Downloading Latest Tarball: ${KEY}"; \
maybe_proxy aria2c -x 16 -s 16 -k 1M --file-allocation=none "${BASE}/${KEY}" -o therock.tar.gz; \
fi && \
mkdir -p /opt/rocm && \
tar xzf therock.tar.gz -C /opt/rocm --strip-components=1 && \
rm therock.tar.gz
# 3. Configure Global ROCm Environment
RUN export ROCM_PATH=/opt/rocm && \