x
This commit is contained in:
+18
-2
@@ -46,8 +46,24 @@ 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 && \
|
||||
|
||||
# 智能处理:如果 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user