# syntax=docker/dockerfile:1-labs # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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. # This CI Dockerfile supports CUDA 13 and CUDA 12 from a single BASE_IMAGE # build arg. The default is the recommended CUDA 13 image: # nvcr.io/nvidia/cuda-dl-base:26.04-cuda13.2-devel-ubuntu24.04 # The current recommended CUDA 12 image is: # nvcr.io/nvidia/cuda-dl-base:25.06-cuda12.9-devel-ubuntu24.04 # # The build derives CUDA_FLAVOR internally from BASE_IMAGE by matching # "cuda13" or "cuda12" in the image tag. That flavor selects the matching uv # extra (cu13 or cu12) and CUDA Python package include path. If BASE_IMAGE does # not contain either token, the build fails early. # # Example CUDA 13 H100+ build: # docker buildx build -f docker/Dockerfile \ # --build-arg GPU_TARGET=h100plus . # Example CUDA 12 A100 build: # docker buildx build -f docker/Dockerfile \ # --build-arg BASE_IMAGE=nvcr.io/nvidia/cuda-dl-base:25.06-cuda12.9-devel-ubuntu24.04 \ # --build-arg GPU_TARGET=a100 . # # GPU_TARGET controls compiled Automodel dependency tuning. "h100plus" builds # for SM90/SM100/SM120 and includes H100+ features such as DeepEP and # flash-attn-4. "a100" builds only SM80 and uses an A100-specific DeepEP patch # to avoid unsupported newer-GPU/NVSHMEM build paths. This keeps CI images # smaller and avoids compiling kernels for architectures a target image cannot # use. ARG BASE_IMAGE=nvcr.io/nvidia/cuda-dl-base:26.04-cuda13.2-devel-ubuntu24.04 FROM ${BASE_IMAGE} AS base-image ARG BASE_IMAGE ARG UV_VERSION=0.11.27 ENV DEBIAN_FRONTEND=noninteractive ENV TRANSFORMERS_OFFLINE=0 ENV HYDRA_FULL_ERROR=1 ENV PYTHONUNBUFFERED=1 ENV UV_PYTHON=3.13 ENV UV_PROJECT_ENVIRONMENT=/opt/venv ENV UV_LINK_MODE=copy ENV UV_NO_CACHE=1 ENV UV_NO_PROGRESS=1 ENV VIRTUAL_ENV=/opt/venv ENV PATH="/root/.local/bin:${VIRTUAL_ENV}/bin:${PATH}" RUN <<"EOF" bash -ex apt-get update apt-get install -y \ curl \ git apt-get clean EOF # NOTE: removed libsndfile1. Soundfile ships with its own version of libsndfile1 RUN <<"EOF" bash -ex curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | sh uv --version EOF RUN <<"EOF" bash -euxo pipefail case "${BASE_IMAGE}" in *cuda12*) cuda_flavor=cu12 ;; *cuda13*) cuda_flavor=cu13 ;; *) echo "Cannot derive CUDA flavor from BASE_IMAGE='${BASE_IMAGE}'. Expected image tag containing 'cuda12' or 'cuda13'." exit 1 ;; esac cuda_major_minor="$(sed -n 's/.*cuda\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' <<<"${BASE_IMAGE}")" if [[ -z "${cuda_major_minor}" ]]; then echo "Cannot derive CUDA major.minor from BASE_IMAGE='${BASE_IMAGE}'. Expected image tag containing e.g. 'cuda12.9' or 'cuda13.2'." exit 1 fi cat >/usr/local/bin/nemo-cuda-flavor <