Skip to content

Commit f3d8a12

Browse files
shumwayclaude
authored andcommitted
[rocm-libraries] ROCm/rocm-libraries#6972 (commit 8761b90)
[CK] Dockerfile: auto-discover latest TheRock nightly tarball (#6972) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation Our docker containers with `--build-arg compiler_version=therock` should have the latest nightly build of TheRock in `/opt/rocm`. When I looked for `rocm_kpack` and other `kpack` artifacts, they were missing, and I realized we had pinned the version by date. Instead, we should look for the most recent linux-multiarch tarball. ## Summary - Auto-discover the latest TheRock nightly tarball at Docker build time instead of pinning a stale URL (previously hardcoded to a Feb 2026 nightly that predates kpack) - Logic is to `wget` the directory, and identify the latest tarball (alphabetically sorted by YYYYMMDD in filename). - Support manual override via `--build-arg TARBALL_URL=...` for pinning, and `--build-arg TARBALL_PATTERN=...` for selecting a specific arch variant - Fix sccache download URL: `/releases/latest/download/` was redirecting to v0.15.0 but the filename referenced v0.14.0, causing a 404 ## Test plan - [x] Verified tarball discovery logic resolves to `therock-dist-linux-multiarch-7.13.0a20260430.tar.gz` - [x] Built Docker image locally with `--build-arg compiler_version=therock` - [x] Confirmed sccache installs successfully with the fixed URL - [ ] Verify CI pipeline builds with the updated Dockerfile 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent de0a61e commit f3d8a12

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

Dockerfile

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@ FROM ubuntu:24.04
33
ARG DEBIAN_FRONTEND=noninteractive
44
ARG ROCMVERSION=7.1.1
55
ARG DEB_ROCM_REPO=http://repo.radeon.com/rocm/apt/.apt_$ROCMVERSION/
6-
ARG TARBALL_URL=https://rocm.nightlies.amd.com/tarball/therock-dist-linux-gfx90X-dcgpu-7.12.0a20260218.tar.gz
6+
7+
# TheRock nightly tarball configuration.
8+
# By default, discovers the latest tarball from the nightlies index.
9+
# Manual overrides:
10+
# Pin a specific tarball:
11+
# --build-arg TARBALL_URL=https://rocm.nightlies.amd.com/tarball-multi-arch/therock-dist-linux-multiarch-7.13.0a20260430.tar.gz
12+
# Change the arch variant (default: multiarch):
13+
# --build-arg TARBALL_PATTERN=therock-dist-linux-gfx90a
14+
# --build-arg TARBALL_PATTERN=therock-dist-linux-gfx94X-dcgpu
15+
ARG TARBALL_URL=""
16+
ARG TARBALL_BASE=https://rocm.nightlies.amd.com/tarball-multi-arch
17+
ARG TARBALL_PATTERN=therock-dist-linux-multiarch
18+
719
ARG compiler_version=""
820
ARG compiler_commit=""
921
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
@@ -18,10 +30,18 @@ RUN set -xe && \
1830

1931
RUN if [ "$compiler_version" = "therock" ]; then \
2032
rm -rf /opt/rocm && mkdir /opt/rocm && \
21-
echo "Downloading ROCm tarball from $TARBALL_URL..." && \
33+
if [ -n "$TARBALL_URL" ]; then \
34+
echo "Using provided TARBALL_URL: $TARBALL_URL" ; \
35+
else \
36+
echo "Discovering latest tarball from $TARBALL_BASE..." && \
37+
TARBALL_URL="${TARBALL_BASE}/$(curl -sL "${TARBALL_BASE}/" \
38+
| grep -oP '"name":\s*"\K'"${TARBALL_PATTERN}"'-[^"]+\.tar\.gz' \
39+
| sort -V | tail -1)" && \
40+
echo "Found: $TARBALL_URL" ; \
41+
fi && \
2242
wget -q -O /tmp/rocm.tar.gz "$TARBALL_URL" && \
23-
echo "Extracting tarball to /opt/rocm..." && \
24-
tar -xzf /tmp/rocm.tar.gz -C /opt/rocm --strip-components=1 ; \
43+
tar -xzf /tmp/rocm.tar.gz -C /opt/rocm --strip-components=1 && \
44+
rm /tmp/rocm.tar.gz ; \
2545
else echo "using the release compiler" && \
2646
wget https://repo.radeon.com/amdgpu-install/7.1.1/ubuntu/noble/amdgpu-install_7.1.1.70101-1_all.deb && \
2747
apt install ./amdgpu-install_7.1.1.70101-1_all.deb -y && \
@@ -36,7 +56,7 @@ ENV SCCACHE_INSTALL_LOCATION=/usr/local/.cargo/bin
3656
ENV PATH=$PATH:${SCCACHE_INSTALL_LOCATION}
3757
RUN set -x && \
3858
mkdir -p ${SCCACHE_INSTALL_LOCATION} && \
39-
wget -qO sccache.tar.gz https://github.com/mozilla/sccache/releases/latest/download/sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz && \
59+
wget -qO sccache.tar.gz https://github.com/mozilla/sccache/releases/download/v$SCCACHE_VERSION/sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz && \
4060
tar -xzf sccache.tar.gz --strip-components=1 -C ${SCCACHE_INSTALL_LOCATION} && \
4161
chmod +x ${SCCACHE_INSTALL_LOCATION}/sccache
4262

0 commit comments

Comments
 (0)