Skip to content

Commit

Permalink
Update docker images (#1172)
Browse files Browse the repository at this point in the history
The new images contain the following updates:

1. Added Git, Ninja and VCPKG to all docker images
2. Updated CPU containers' GCC version from 12 to 14
3. Pinned CUDA 12 images' CUDNN version to 9.5(The latest one is 9.6)
4. Addressed container supply chain warnings by building CUDA 12 images
from scratch(avoid using Nvidia's prebuilt images)
5. Updated manylinux commit id to
75aeda9d18eafb323b00620537c8b4097d4bef48
6. python 3.8 and 3.9 were removed.
  • Loading branch information
snnn authored Jan 10, 2025
1 parent 636a95e commit 44e541e
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 110 deletions.
4 changes: 2 additions & 2 deletions .pipelines/stages/jobs/nuget-validation-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ jobs:

- name: cuda_docker_image
${{ if eq(parameters.cuda_version, '11.8') }}:
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda11_x64_almalinux8_gcc11:20240531.1
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda11_x64_almalinux8_gcc11:20250109.1
${{ else }}:
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_ubi8_gcc12:20240610.1
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_ubi8_gcc12:20250109.1

workspace:
clean: all
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/stages/jobs/py-validation-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ jobs:

- name: cuda_docker_image
${{ if eq(parameters.cuda_version, '11.8') }}:
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda11_x64_almalinux8_gcc11:20240531.1
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda11_x64_almalinux8_gcc11:20250109.1
${{ else }}:
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_ubi8_gcc12:20240610.1
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_ubi8_gcc12:20250109.1

steps:
- checkout: self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

FROM onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cpu_aarch64_ubi8_gcc12:20240531.1
FROM onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cpu_aarch64_ubi8_gcc14:20250109.1

ADD scripts /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ dnf install -y \
glibc-langpack-\* glibc-locale-source which redhat-lsb-core \
expat-devel tar unzip zlib-devel make bzip2 bzip2-devel \
java-11-openjdk-devel graphviz \
gcc-toolset-12-binutils gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran \
git
locale
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cpu_x64_ubi8_gcc12:20240530.3
FROM onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cpu_x64_ubi8_gcc14:20250109.1

ADD scripts /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_centos_gcc12.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts

ARG BUILD_UID=1001
ARG BUILD_USER=onnxruntimedev
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
ARG BASEIMAGE=onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda11_x64_almalinux8_gcc11:20240530.3
ARG BASEIMAGE=onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda11_x64_almalinux8_gcc11:20250109.1

FROM $BASEIMAGE
ADD scripts /tmp/scripts

RUN if [ "$(echo $CUDA_VERSION | cut -d. -f1)" -ge 12 ]; then \
echo "Using GCC 12 because CUDA version is greater than or equal to 12"; \
cd /tmp/scripts && /tmp/scripts/install_centos_gcc12.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts; \
else \
echo "Using default gcc because CUDA version is less than 12"; \
cd /tmp/scripts && /tmp/scripts/install_centos.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts; \
fi
RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts;


ARG BUILD_UID=1001
ARG BUILD_USER=onnxruntimedev
Expand All @@ -18,4 +13,4 @@ WORKDIR /home/$BUILD_USER
USER $BUILD_USER
ENV PATH /usr/local/dotnet:$PATH
ENV CUDAHOSTCXX /opt/rh/gcc-toolset-11/root/usr/bin/g++
ENV CUDA_MODULE_LOADING "LAZY"
ENV CUDA_MODULE_LOADING "LAZY"
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
ARG BASEIMAGE=onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_ubi8_gcc12:20240610.1
ARG BASEIMAGE=onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_ubi8_gcc12:20250109.1

FROM $BASEIMAGE
ADD scripts /tmp/scripts

RUN if [ "$(echo $CUDA_VERSION | cut -d. -f1)" -ge 12 ]; then \
echo "Using GCC 12 because CUDA version is greater than or equal to 12"; \
cd /tmp/scripts && /tmp/scripts/install_centos_gcc12.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts; \
else \
echo "Using default gcc because CUDA version is less than 12"; \
cd /tmp/scripts && /tmp/scripts/install_centos.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts; \
fi
RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts

ARG BUILD_UID=1001
ARG BUILD_USER=onnxruntimedev
RUN adduser --uid $BUILD_UID $BUILD_USER
WORKDIR /home/$BUILD_USER
USER $BUILD_USER
ENV PATH /usr/local/dotnet:$PATH
ENV CUDAHOSTCXX /opt/rh/gcc-toolset-12/root/usr/bin/g++
ENV CUDA_MODULE_LOADING "LAZY"
ENV CUDA_MODULE_LOADING "LAZY"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cpu_x64_ubi8_gcc12:20240530.3
FROM onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cpu_x64_ubi8_gcc14:20250109.1

ADD scripts /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_centos_gcc12.sh && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts
RUN cd /tmp/scripts && /tmp/scripts/install_deps.sh && rm -rf /tmp/scripts

ARG BUILD_UID=1001
ARG BUILD_USER=onnxruntimedev
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e -x
pushd .
PYTHON_EXES=("/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10" "/opt/python/cp311-cp311/bin/python3.11" "/opt/python/cp312-cp312/bin/python3.12")
PYTHON_EXES=("/opt/python/cp310-cp310/bin/python3.10" "/opt/python/cp311-cp311/bin/python3.11" "/opt/python/cp312-cp312/bin/python3.12")

popd
export ONNX_ML=1
Expand All @@ -12,73 +12,3 @@ do
${PYTHON_EXE} -m pip install -r requirements.txt
done

# No release binary for ccache aarch64, so we need to build it from source.
if ! [ -x "$(command -v ccache)" ]; then
ccache_url="https://github.com/ccache/ccache/archive/refs/tags/v4.8.tar.gz"
pushd .
curl -sSL --retry 5 --retry-delay 10 --create-dirs --fail -L -o ccache_src.tar.gz $ccache_url
mkdir ccache_main
cd ccache_main
tar -zxf ../ccache_src.tar.gz --strip=1

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local _DCMAKE_BUILD_TYPE=Release ..
make
make install
which ccache
popd
rm -f ccache_src.tar.gz
rm -rf ccache_src
fi

# Download a file from internet
function GetFile {
local uri=$1
local path=$2
local force=${3:-false}
local download_retries=${4:-5}
local retry_wait_time_seconds=${5:-30}

if [[ -f $path ]]; then
if [[ $force = false ]]; then
echo "File '$path' already exists. Skipping download"
return 0
else
rm -rf "$path"
fi
fi

if [[ -f $uri ]]; then
echo "'$uri' is a file path, copying file to '$path'"
cp "$uri" "$path"
return $?
fi

echo "Downloading $uri"
curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail
return $?
}
mkdir -p /tmp/src

cd /tmp/src

CPU_ARCH=$(uname -m)

# Install CMake
echo "Installing cmake"
GetFile "https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-linux-$CPU_ARCH.tar.gz" "/tmp/src/cmake.tar.gz"
tar -zxf /tmp/src/cmake.tar.gz --strip=1 -C /usr

# Install Ninja
echo "Installing Ninja"
GetFile https://github.com/ninja-build/ninja/archive/v1.10.0.tar.gz /tmp/src/ninja-linux.tar.gz
tar -zxf ninja-linux.tar.gz
pushd ninja-1.10.0
cmake -Bbuild-cmake -H.
cmake --build build-cmake
mv ./build-cmake/ninja /usr/bin
popd

cd /
rm -rf /tmp/src

0 comments on commit 44e541e

Please sign in to comment.