Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docker/Dockerfile.multi
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ RUN --mount=type=bind,source=docker/common,target=/opt/docker/common \
--mount=type=cache,target=/root/.cache/pip \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
--mount=type=secret,id=github_clone_token \
echo "Using GitHub mirror: ${GITHUB_MIRROR}" && \
echo "Using Python version: ${PYTHON_VERSION}" && \
. /opt/docker/common/github_auth.sh && \
GITHUB_MIRROR=${GITHUB_MIRROR} \
PYTHON_VERSION=${PYTHON_VERSION} \
CUDA_VER=${CUDA_VER} CUDNN_VER=${CUDNN_VER} \
Expand All @@ -68,6 +70,9 @@ RUN --mount=type=bind,source=docker/common,target=/opt/docker/common \
COPY constraints.txt /tmp/constraints.txt
# constraints.txt is also consumed as a pip constraint file, which forbids extras.
RUN --mount=type=cache,target=/root/.cache/pip \
if [ -n "$GITHUB_MIRROR" ]; then \
export PIP_INDEX_URL="https://urm.nvidia.com/artifactory/api/pypi/pypi-remote/simple"; \
fi && \
pip3 uninstall -y tornado black nbconvert pillow nvidia-cutlass-dsl nvidia-cutlass-dsl-libs-base \
nvidia-cutlass-dsl-libs-core nvidia-cutlass-dsl-libs-cu12 nvidia-cutlass-dsl-libs-cu13 numpy wandb || true && \
# Remove any leftover namespace dirs or dist-info that pip missed
Expand All @@ -81,6 +86,8 @@ RUN --mount=type=bind,source=docker/common,target=/opt/docker/common \
--mount=type=cache,target=/root/.cache/pip \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
--mount=type=secret,id=github_clone_token \
. /opt/docker/common/github_auth.sh && \
GITHUB_MIRROR=${GITHUB_MIRROR} bash /opt/docker/common/install_ucx.sh && \
GITHUB_MIRROR=${GITHUB_MIRROR} bash /opt/docker/common/install_nixl.sh && \
bash /opt/docker/common/install_etcd.sh && \
Expand Down Expand Up @@ -114,6 +121,8 @@ COPY --from=triton /opt/tritonserver/caches /opt/tritonserver/caches

# Install Triton deps, Mooncake, and CI tooling packages
RUN --mount=type=bind,source=docker/common,target=/opt/docker/common \
--mount=type=secret,id=github_clone_token \
. /opt/docker/common/github_auth.sh && \
GITHUB_MIRROR=${GITHUB_MIRROR} bash /opt/docker/common/install_triton.sh && \
if [ -f /etc/redhat-release ]; then \
echo "Rocky8 detected, skipping mooncake installation"; \
Expand All @@ -139,9 +148,13 @@ ARG GITHUB_MIRROR=""
ARG BUILD_WHEEL_ARGS="--clean"
ARG BUILD_WHEEL_SCRIPT="scripts/build_wheel.py"
RUN --mount=type=cache,target=/root/.cache/pip --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=secret,id=github_clone_token \
if [ -n "$GITHUB_MIRROR" ]; then \
export PIP_INDEX_URL="https://urm.nvidia.com/artifactory/api/pypi/pypi-remote/simple"; \
fi && \
# Authenticates `git submodule update` and the CMake FetchContent clones
# (3rdparty/fetch_content.json) that this build pulls from github.com.
. docker/common/github_auth.sh && \
TRTLLM_BUILD_SOURCE_COMMIT=${GIT_COMMIT} \
GITHUB_MIRROR=${GITHUB_MIRROR} \
python3 ${BUILD_WHEEL_SCRIPT} ${BUILD_WHEEL_ARGS}
Expand Down
8 changes: 8 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ CUBLAS_VERSION ?=
GIT_COMMIT ?= $(shell git rev-parse HEAD)
TRT_LLM_VERSION ?= $(shell grep '^__version__' ../tensorrt_llm/version.py | grep -o '=.*' | tr -d '= "')
GITHUB_MIRROR ?=
# Optional GitHub token used to authenticate the github.com clones performed
# during the build (see docker/common/github_auth.sh). Usually inherited from the
# environment, never passed as a build arg -- build-arg values stay readable in
# `docker history`. Empty means anonymous, rate-limited access.
GITHUB_CLONE_TOKEN ?=
COMMA := ,
GITHUB_SECRET_ARG := $(if $(GITHUB_CLONE_TOKEN),--secret id=github_clone_token$(COMMA)env=GITHUB_CLONE_TOKEN)
PYTHON_VERSION ?=
NGC_STAGING_REPO ?= nvcr.io/nvstaging/tensorrt-llm
NGC_REPO ?= nvcr.io/nvidia/tensorrt-llm
Expand Down Expand Up @@ -87,6 +94,7 @@ base_pull:
@echo "Building docker image: $(IMAGE_WITH_TAG)"
docker buildx build $(DOCKER_BUILD_OPTS) $(DOCKER_BUILD_ARGS) \
--progress $(DOCKER_PROGRESS) \
$(GITHUB_SECRET_ARG) \
$(if $(BASE_IMAGE), --build-arg BASE_IMAGE=$(BASE_IMAGE)) \
$(if $(BASE_TAG), --build-arg BASE_TAG=$(BASE_TAG)) \
$(if $(TRITON_IMAGE), --build-arg TRITON_IMAGE=$(TRITON_IMAGE)) \
Expand Down
110 changes: 110 additions & 0 deletions docker/common/github_auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Enable authenticated access to github.com for this shell and everything it
# spawns: the `git clone`s in install_*.sh, `git submodule update` and the CMake
# FetchContent clones of the wheel build, `pip install git+https://github.com/...`
# and so on.
Comment thread
weiminwang-nv marked this conversation as resolved.
#
# GitHub meters anonymous requests per source IP and a whole CI pool shares very
# few of them, so unauthenticated clones start getting throttled once the
# pipeline is busy; requests carrying a token are metered per account instead.
#
# The token is optional -- without it everything falls back to anonymous access.
# It is read from a BuildKit secret mount (`docker buildx build --secret
# id=github_clone_token,env=GITHUB_CLONE_TOKEN`, wired up in docker/Makefile) or
# straight from GITHUB_CLONE_TOKEN in the environment.
#
# The rewrite is published through GIT_CONFIG_* environment variables on purpose:
# `git config --global` would write the token into $HOME/.gitconfig and bake it
# into the image layer. Env config needs git >= 2.31, which is checked up front
# (see git_env_config_supported below).
#
# Source this file, do not execute it:
# . /opt/docker/common/github_auth.sh
# Sourcing it more than once (a RUN layer that already set it up calling an
# install script that sources it again) is a no-op -- the first one wins.

# git only reads GIT_CONFIG_COUNT / GIT_CONFIG_KEY_n / GIT_CONFIG_VALUE_n from
# the environment since 2.31 (2021-03). An older git silently ignores them, so
# an intended authenticated clone would quietly degrade to an anonymous one --
# detect that here and say so rather than letting it happen unnoticed.
git_env_config_supported() {
local version major minor
command -v git >/dev/null 2>&1 || return 1
version=$(git --version 2>/dev/null | sed -n 's/^git version \([0-9][0-9.]*\).*/\1/p')
[ -n "$version" ] || return 1
major="${version%%.*}"
minor="${version#*.}"
minor="${minor%%.*}"
case "$major$minor" in *[!0-9]*|"") return 1 ;; esac
if [ "$major" -gt 2 ]; then
return 0
fi
if [ "$major" -eq 2 ] && [ "$minor" -ge 31 ]; then
return 0
fi
return 1
}

setup_github_auth() {
# Keep the token out of the build log even under `set -x`.
local restore_x=""
case "$-" in *x*) restore_x=1 ;; esac
set +x

if [ -n "${GITHUB_AUTH_CONFIGURED:-}" ]; then
if [ -n "$restore_x" ]; then set -x; fi
return 0
fi

if ! git_env_config_supported; then
local git_desc
git_desc=$(git --version 2>/dev/null) || git_desc="git not found"
echo "[github_auth] ${git_desc}: no GIT_CONFIG_* environment support" \
"(needs git >= 2.31), using anonymous github.com access."
if [ -n "$restore_x" ]; then set -x; fi
return 0
fi

local token="${GITHUB_CLONE_TOKEN:-}"
local secret_file="${GITHUB_CLONE_TOKEN_FILE:-/run/secrets/github_clone_token}"
if [ -z "$token" ] && [ -r "$secret_file" ]; then
token=$(cat "$secret_file")
fi

if [ -z "$token" ]; then
echo "[github_auth] No GitHub token available, using anonymous github.com access."
if [ -n "$restore_x" ]; then set -x; fi
return 0
fi

# Append rather than overwrite, in case the caller already carries its own
# GIT_CONFIG_* entries. Per-repo mirrors (GITHUB_MIRROR, the GitLab mirrors
# configured on CI agents) keep winning over this catch-all rewrite: git
# resolves insteadOf by longest matching prefix.
local idx="${GIT_CONFIG_COUNT:-0}"
export "GIT_CONFIG_KEY_${idx}=url.https://x-access-token:${token}@github.com/.insteadOf"
export "GIT_CONFIG_VALUE_${idx}=https://github.com/"
export GIT_CONFIG_COUNT=$((idx + 1))
export GITHUB_AUTH_CONFIGURED=1
echo "[github_auth] Using authenticated github.com access."

if [ -n "$restore_x" ]; then set -x; fi
return 0
}

setup_github_auth
3 changes: 3 additions & 0 deletions docker/common/install_mooncake.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
set -ex

# Authenticate the github.com clones below; no-op when no token is available.
source "$(dirname "${BASH_SOURCE[0]}")/github_auth.sh"

Comment thread
weiminwang-nv marked this conversation as resolved.
MOONCAKE_VERSION="v0.3.7.post2"
MOONCAKE_REPO="https://github.com/kvcache-ai/Mooncake.git"
MOONCAKE_INSTALL_PATH="/usr/local/Mooncake"
Expand Down
3 changes: 3 additions & 0 deletions docker/common/install_nixl.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
set -ex

# Authenticate the github.com clone below; no-op when no token is available.
source "$(dirname "${BASH_SOURCE[0]}")/github_auth.sh"

GITHUB_URL="https://github.com"
UCX_INSTALL_PATH="/usr/local/ucx/"
CUDA_PATH="/usr/local/cuda"
Expand Down
8 changes: 8 additions & 0 deletions docker/common/install_pytorch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

set -ex

# Authenticate the github.com clones in the source install paths below; no-op
# when no token is available.
source "$(dirname "${BASH_SOURCE[0]}")/github_auth.sh"

if [ -n "${GITHUB_MIRROR}" ]; then
export PIP_INDEX_URL="https://urm.nvidia.com/artifactory/api/pypi/pypi-remote/simple"
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# Use latest stable version from https://pypi.org/project/torch/#history
# and closest to the version specified in
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel-26-05.html#rel-26-05
Expand Down
19 changes: 15 additions & 4 deletions docker/common/install_ucx.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
set -ex

# Authenticate the github.com clone below; no-op when no token is available.
source "$(dirname "${BASH_SOURCE[0]}")/github_auth.sh"

UCX_VERSION="v1.22.x"
UCX_COMMIT="8a6b06fb880accbb933a79cda893883872c68d9d"
UCX_INSTALL_PATH="/usr/local/ucx/"
Expand All @@ -10,12 +13,20 @@ UCX_REPO="https://github.com/openucx/ucx.git"
mkdir -p /third-party-source

rm -rf ${UCX_INSTALL_PATH}
git clone -b ${UCX_VERSION} ${UCX_REPO}
cd ucx
git checkout ${UCX_COMMIT}
cd ..

# Fetch just the pinned commit rather than cloning the whole history
rm -rf ucx
git init -q ucx
git -C ucx remote add origin ${UCX_REPO}
git -C ucx fetch -q --depth 1 origin ${UCX_COMMIT}
git -C ucx checkout -q FETCH_HEAD

tar -czf /third-party-source/ucx-${UCX_VERSION}.tar.gz ucx
cd ucx
# Pull external/gpunetio shallow, for the same reason: autogen.sh below does a
# full-history `git submodule update --init` on it. With the submodule already
# at the recorded commit that call does nothing.
git submodule update --init --depth 1
Comment thread
coderabbitai[bot] marked this conversation as resolved.
./autogen.sh
./contrib/configure-release \
--prefix=${UCX_INSTALL_PATH} \
Expand Down
4 changes: 4 additions & 0 deletions jenkins/BuildDockerImage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,10 @@ pipeline {
environment {
CCACHE_DIR="${CCACHE_DIR}"
PIP_INDEX_URL="https://urm.nvidia.com/artifactory/api/pypi/pypi-remote/simple"
// Picked up by docker/Makefile and handed to `docker buildx build` as a
// BuildKit secret, which authenticates the github.com clones inside the
// image build (docker/common/github_auth.sh).
GITHUB_CLONE_TOKEN = credentials('github_read_public_only_token')
Comment thread
weiminwang-nv marked this conversation as resolved.
}
stages {
stage("Setup Environment") {
Expand Down
10 changes: 5 additions & 5 deletions jenkins/current_image_tags.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# images are adopted from PostMerge pipelines, the abbreviated commit hash is used instead.
IMAGE_NAME=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm

LLM_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:pytorch-26.05-py3-x86_64-ubuntu24.04-skip-tritondevel-202608271702-17084
LLM_SBSA_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:pytorch-26.05-py3-sbsa-ubuntu24.04-skip-tritondevel-202608271702-17084
LLM_ROCKYLINUX8_PY310_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:cuda-13.2.1-devel-rocky8-x86_64-rocky8-py310-skip-tritondevel-202608271702-17084
LLM_ROCKYLINUX8_PY312_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:cuda-13.2.1-devel-rocky8-x86_64-rocky8-py312-skip-tritondevel-202608271702-17084
LLM_SBSA_WHEEL_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:cuda-13.2.1-devel-ubuntu24.04-sbsa-ubuntu24.04-py312-skip-tritondevel-202608271702-17084
LLM_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:pytorch-26.05-py3-x86_64-ubuntu24.04-skip-tritondevel-202608311413-17788
LLM_SBSA_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:pytorch-26.05-py3-sbsa-ubuntu24.04-skip-tritondevel-202608311413-17788
LLM_ROCKYLINUX8_PY310_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:cuda-13.2.1-devel-rocky8-x86_64-rocky8-py310-skip-tritondevel-202608311413-17788
LLM_ROCKYLINUX8_PY312_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:cuda-13.2.1-devel-rocky8-x86_64-rocky8-py312-skip-tritondevel-202608311413-17788
LLM_SBSA_WHEEL_DOCKER_IMAGE=artifactory.nvidia.com/sw-tensorrt-llm-docker-local/tensorrt-llm:cuda-13.2.1-devel-ubuntu24.04-sbsa-ubuntu24.04-py312-skip-tritondevel-202608311413-17788
Loading