diff --git a/Dockerfile b/Dockerfile index 0f907aa..9b39bf1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,20 +15,29 @@ RUN dnf -y --refresh --setopt=install_weak_deps=False --setopt=metadata_expire=3 && dnf clean all && rm -rf /var/cache/dnf/* # 2. Install "TheRock" ROCm SDK (Tarball Method) +# Note: You can pre-download the tarball to /tmp/therock.tar.gz to speed up build WORKDIR /tmp ARG ROCM_MAJOR_VER=7 ARG GFX=gfx120X-all -RUN set -euo pipefail; \ - BASE="https://therock-nightly-tarball.s3.amazonaws.com"; \ - PREFIX="therock-dist-linux-${GFX}-${ROCM_MAJOR_VER}"; \ - KEY="$(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}"; \ - aria2c -x 16 -s 16 -j 16 --file-allocation=none --async-dns=false --max-overall-download-limit=0 --max-download-limit=0 --min-split-size=1M "${BASE}/${KEY}" -o therock.tar.gz; \ - mkdir -p /opt/rocm; \ - tar xzf therock.tar.gz -C /opt/rocm --strip-components=1; \ +RUN if [ -f /tmp/therock.tar.gz ]; then \ + echo "Using pre-downloaded tarball"; \ + else \ + set -euo pipefail; \ + BASE="https://therock-nightly-tarball.s3.amazonaws.com"; \ + PREFIX="therock-dist-linux-${GFX}-${ROCM_MAJOR_VER}"; \ + KEY="$(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}"; \ + aria2c -x 16 -s 16 -j 16 --file-allocation=none --async-dns=false \ + --max-overall-download-limit=0 --max-download-limit=0 \ + --min-split-size=1M --retry-wait=5 --max-tries=0 \ + --timeout=600 --connect-timeout=60 \ + "${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