chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:17:40 +08:00
commit f1825c8ceb
10096 changed files with 2364182 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
Overview of how the ray images are built:
Images without a "-cpu" or "-gpu" tag are built on ``ubuntu:22.04``. They are just an alias for **-cpu** (e.g. ``ray:latest`` is the same as ``ray:latest-cpu``).
```
ubuntu:22.04
└── base-deps:cpu
└── ray:cpu
nvidia/cuda
└── base-deps:cudaXXX
└── ray:cudaXXX
└── ray-llm:cudaXXX
```
+1
View File
@@ -0,0 +1 @@
# DEPRECATED -- Please use [`rayproject/ray-ml`](https://hub.docker.com/repository/docker/rayproject/ray-ml)
+132
View File
@@ -0,0 +1,132 @@
# syntax=docker/dockerfile:1.3-labs
# The base-deps Docker image installs main libraries needed to run Ray
# The GPU options are NVIDIA CUDA developer images.
ARG BASE_IMAGE="ubuntu:22.04"
FROM ${BASE_IMAGE}
# If this arg is not "autoscaler" then no autoscaler requirements will be included
ENV TZ=America/Los_Angeles
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# TODO(ilr) $HOME seems to point to result in "" instead of "/home/ray"
# Q: Why add paths like /usr/local/nvidia/lib64 and /usr/local/nvidia/bin?
# A: The NVIDIA GPU operator version used by GKE injects these into the container
# after it's mounted to a pod.
# Issue is tracked here:
# https://github.com/GoogleCloudPlatform/compute-gpu-installation/issues/46
# More context here:
# https://github.com/NVIDIA/nvidia-container-toolkit/issues/275
# and here:
# https://gitlab.com/nvidia/container-images/cuda/-/issues/27
ENV PATH "/home/ray/anaconda3/bin:$PATH:/usr/local/nvidia/bin"
ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/usr/local/nvidia/lib64"
ARG DEBIAN_FRONTEND=noninteractive
ARG PYTHON_VERSION=3.10
ARG CONSTRAINTS_FILE="python/requirements_compiled_py${PYTHON_VERSION}.txt"
ARG PYTHON_DEPSET="python/deplocks/base_deps/ray_base_deps_py${PYTHON_VERSION}.lock"
ARG RAY_UID=1000
ARG RAY_GID=100
RUN <<EOF
#!/bin/bash
set -euo pipefail
apt-get update -y
apt-get upgrade -y
APT_PKGS=(
sudo
tzdata
git
libjemalloc-dev
wget
cmake
g++
zlib1g-dev
# For autoscaler
tmux
screen
rsync
netbase
openssh-client
gnupg
)
apt-get install -y "${APT_PKGS[@]}"
useradd -ms /bin/bash -d /home/ray ray --uid $RAY_UID --gid $RAY_GID
usermod -aG sudo ray
echo 'ray ALL=NOPASSWD: ALL' >> /etc/sudoers
EOF
USER $RAY_UID
ENV HOME=/home/ray
WORKDIR /home/ray
COPY --chown=ray "$CONSTRAINTS_FILE" /home/ray/requirements_compiled.txt
COPY --chown=ray "$PYTHON_DEPSET" /home/ray/python_depset.lock
SHELL ["/bin/bash", "-c"]
RUN <<EOF
#!/bin/bash
set -euo pipefail
# Determine the architecture of the host
if [[ "${HOSTTYPE}" =~ ^x86_64 ]]; then
ARCH="x86_64"
elif [[ "${HOSTTYPE}" =~ ^aarch64 ]]; then
ARCH="aarch64"
else
echo "Unsupported architecture ${HOSTTYPE}" >/dev/stderr
exit 1
fi
# Install miniforge
wget --quiet \
"https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-24.11.3-0-Linux-${ARCH}.sh" \
-O /tmp/miniforge.sh
/bin/bash /tmp/miniforge.sh -b -u -p $HOME/anaconda3
$HOME/anaconda3/bin/conda init
echo 'export PATH=$HOME/anaconda3/bin:$PATH' >> $HOME/.bashrc
rm /tmp/miniforge.sh
$HOME/anaconda3/bin/conda install -y libgcc-ng python=$PYTHON_VERSION
$HOME/anaconda3/bin/conda install -y -c conda-forge libffi=3.4.6
$HOME/anaconda3/bin/conda clean -y --all
# Install uv
wget -qO- https://astral.sh/uv/install.sh | sudo -E env UV_UNMANAGED_INSTALL="/usr/local/bin" sh
# Set up Conda as system Python
export PATH=$HOME/anaconda3/bin:$PATH
# Some packages are on PyPI as well as other indices, but the latter
# (unhelpfully) take precedence. We use `--index-strategy unsafe-best-match`
# to ensure that the best match is chosen from the available indices.
uv pip install --system --no-cache-dir --no-deps --index-strategy unsafe-best-match \
-r $HOME/python_depset.lock
# We install cmake temporarily to get psutil
sudo apt-get autoremove -y cmake zlib1g-dev
# We keep g++ on GPU images, because uninstalling removes CUDA Devel tooling
if [[ ! -d /usr/local/cuda ]]; then
sudo apt-get autoremove -y g++
fi
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get clean
EOF
WORKDIR $HOME
+42
View File
@@ -0,0 +1,42 @@
## About
This is an internal image, the [`rayproject/ray`](https://hub.docker.com/repository/docker/rayproject/ray) or [`rayproject/ray-ml`](https://hub.docker.com/repository/docker/rayproject/ray-ml) should be used!
This image has the system-level dependencies for `Ray` and the `Ray Autoscaler`. The `ray-deps` image is built on top of this. This image is built periodically or when dependencies are added. [Find the Dockerfile here.](https://github.com/ray-project/ray/blob/master/docker/base-deps/Dockerfile)
## Tags
Images are `tagged` with the format `{Ray version}[-{Python version}][-{Platform}][-{Architecture}]`. `Ray version` tag can be one of the following:
| Ray version tag | Description |
| --------------- | ----------- |
| `latest` | The most recent Ray release. |
| `x.y.z` | A specific Ray release, e.g. 2.9.3 |
| `nightly` | The most recent Ray development build (a recent commit from GitHub `master`) |
The optional `Python version` tag specifies the Python version in the image. All Python versions supported by Ray are available, e.g. `py39`, `py310` and `py311`. If unspecified, the tag points to an image using `Python 3.9`.
The optional `Platform` tag specifies the platform where the image is intended for:
| Platform tag | Description |
| --------------- | ----------- |
| `-cpu` | These are based off of an Ubuntu image. |
| `-cuXX` | These are based off of an NVIDIA CUDA image with the specified CUDA version `xx`. They require the NVIDIA Docker Runtime. |
| `-gpu` | Aliases to a specific `-cuXX` tagged image. |
| no tag | Aliases to `-cpu` tagged images for `ray`, and aliases to ``-gpu`` tagged images for `ray-ml`. |
The optional `Architecture` tag can be used to specify images for different CPU architectures.
Currently, we support the `x86_64` (`amd64`) and `aarch64` (`arm64`) architectures.
Please note that suffixes are only used to specify `aarch64` images. No suffix means
`x86_64`/`amd64`-compatible images.
| Platform tag | Description |
|--------------|-------------------------|
| `-aarch64` | arm64-compatible images |
| no tag | Defaults to `amd64` |
----
See [`rayproject/ray`](https://hub.docker.com/repository/docker/rayproject/ray) for Ray and all of its dependencies.
+12
View File
@@ -0,0 +1,12 @@
name: "ray-py$PYTHON_VERSION-cpu-base$ARCH_SUFFIX"
froms: ["ubuntu:22.04"]
dockerfile: docker/base-deps/Dockerfile
srcs:
- python/requirements_compiled.txt
- python/requirements_compiled_py$PYTHON_VERSION.txt
- python/deplocks/base_deps/ray_base_deps_py$PYTHON_VERSION.lock
build_args:
- PYTHON_VERSION
- BASE_IMAGE=ubuntu:22.04
tags:
- cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cpu-base$ARCH_SUFFIX
+12
View File
@@ -0,0 +1,12 @@
name: "ray-py$PYTHON_VERSION-cu$CUDA_VERSION-base$ARCH_SUFFIX"
froms: ["nvidia/cuda:$CUDA_VERSION-devel-ubuntu22.04"]
dockerfile: docker/base-deps/Dockerfile
srcs:
- python/requirements_compiled.txt
- python/requirements_compiled_py$PYTHON_VERSION.txt
- python/deplocks/base_deps/ray_base_deps_py$PYTHON_VERSION.lock
build_args:
- PYTHON_VERSION
- BASE_IMAGE=nvidia/cuda:$CUDA_VERSION-devel-ubuntu22.04
tags:
- cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cu$CUDA_VERSION-base$ARCH_SUFFIX
+14
View File
@@ -0,0 +1,14 @@
setuptools==80.9.0
flatbuffers
cython
numpy # Necessary for Dataset to work properly.
psutil
# For the ease to submit jobs on various cloud providers.
smart_open[s3,gcs,azure,http]
six
boto3
pyopenssl
cryptography
google-api-python-client
google-oauth
adlfs[abfs]
+18
View File
@@ -0,0 +1,18 @@
# Pin to satisfy both cupy (needs <2.3) and JAX (needs >2.0)
numpy>=2.0
# Minimum version for tpu7x compatibility
jax[tpu]>=0.8.2; python_version >= "3.11"
jax[tpu]; python_version < "3.11"
# Standard JAX ecosystem dependencies
flax
optax
orbax-checkpoint
ml-collections
# TPU profiling & telemetry
cloud-tpu-diagnostics
tensorboard-plugin-profile
ml-goodput-measurement
tpu-info
+13
View File
@@ -0,0 +1,13 @@
name: "ray-py$PYTHON_VERSION-tpu-base$ARCH_SUFFIX"
froms: ["ubuntu:22.04"]
dockerfile: docker/base-deps/Dockerfile
srcs:
- python/requirements_compiled.txt
- python/requirements_compiled_py$PYTHON_VERSION.txt
- python/deplocks/base_deps/ray_base_deps_tpu_py$PYTHON_VERSION.lock
build_args:
- PYTHON_VERSION
- BASE_IMAGE=ubuntu:22.04
- PYTHON_DEPSET=python/deplocks/base_deps/ray_base_deps_tpu_py$PYTHON_VERSION.lock
tags:
- cr.ray.io/rayproject/ray-py$PYTHON_VERSION-tpu-base$ARCH_SUFFIX
+11
View File
@@ -0,0 +1,11 @@
name: "$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base-extra-testdeps"
froms: ["cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base-extra"]
dockerfile: release/ray_release/byod/byod.Dockerfile
srcs:
- python/deplocks/base_extra_testdeps/$IMAGE_TYPE-base_extra_testdeps_py$PYTHON_VERSION.lock
build_args:
- BASE_IMAGE=cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base-extra
- PYTHON_VERSION
- IMAGE_TYPE
tags:
- cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base-extra-testdeps
@@ -0,0 +1,11 @@
name: "$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base-extra-testdeps"
froms: ["cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base-extra"]
dockerfile: release/ray_release/byod/byod.Dockerfile
srcs:
- python/deplocks/base_extra_testdeps/$IMAGE_TYPE-base_extra_testdeps_py$PYTHON_VERSION.lock
build_args:
- BASE_IMAGE=cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base-extra
- PYTHON_VERSION
- IMAGE_TYPE
tags:
- cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base-extra-testdeps
+193
View File
@@ -0,0 +1,193 @@
# syntax=docker/dockerfile:1.3-labs
ARG BASE_IMAGE="rayproject/ray:latest"
FROM "$BASE_IMAGE"
ENV TERM=xterm
ARG SSH_PORT=5020
ARG PYTHON_VERSION=3.10
ARG PYTHON_DEPSET="python/deplocks/base_extra/ray_base_extra_py${PYTHON_VERSION}.lock"
COPY "$PYTHON_DEPSET" /home/ray/python_depset.lock
RUN <<EOF
#!/bin/bash
set -exuo pipefail
if [[ "$HOSTTYPE" =~ ^x86_64 ]]; then
ARCH="x86_64"
elif [[ "$HOSTTYPE" =~ ^aarch64 ]]; then
ARCH="aarch64"
else
echo "Unsupported architecture $MACHTYPE" >/dev/stderr
exit 1
fi
# Create boto config; makes gsutil happy.
echo "[GoogleCompute]" > "${HOME}/.boto"
echo "service_account = default" >> "${HOME}/.boto"
chmod 600 "${HOME}/.boto"
if [[ "$ARCH" == "x86_64" ]]; then
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
else
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/arm64/7fa2af80.pub
# Nvidia does not have machine-learning repo for arm64
fi
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \
| sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
# Add gdb since ray dashboard uses `memray attach`, which requires gdb.
APT_PKGS=(
google-cloud-sdk
supervisor
vim
zsh
nfs-common
zip
unzip
build-essential
ssh
curl
gdb
)
sudo apt-get update -y
sudo apt-get install -y "${APT_PKGS[@]}"
sudo apt-get autoclean
# Install azcopy
AZCOPY_VERSION="10.30.0"
AZCOPY_TMP="$(mktemp -d)"
(
cd "${AZCOPY_TMP}"
if [[ "$ARCH" == "x86_64" ]]; then
curl -sSfL "https://github.com/Azure/azure-storage-azcopy/releases/download/v${AZCOPY_VERSION}/azcopy_linux_amd64_${AZCOPY_VERSION}.tar.gz" \
-o- | tar -xz "azcopy_linux_amd64_${AZCOPY_VERSION}/azcopy"
sudo mv "azcopy_linux_amd64_${AZCOPY_VERSION}/azcopy" /usr/local/bin/azcopy
else
curl -sSfL "https://github.com/Azure/azure-storage-azcopy/releases/download/v${AZCOPY_VERSION}/azcopy_linux_arm64_${AZCOPY_VERSION}.tar.gz" \
-o- | tar -xz "azcopy_linux_arm64_${AZCOPY_VERSION}/azcopy"
sudo mv "azcopy_linux_arm64_${AZCOPY_VERSION}/azcopy" /usr/local/bin/azcopy
fi
)
rm -rf "${AZCOPY_TMP}"
# Install dynolog, only on x86_64 machines.
if [[ "$ARCH" == "x86_64" ]]; then
DYNOLOG_TMP="$(mktemp -d)"
(
cd "${DYNOLOG_TMP}"
curl -sSL https://github.com/facebookincubator/dynolog/releases/download/v0.3.2/dynolog_0.3.2-0-amd64.deb -o dynolog_0.3.2-0-amd64.deb
sudo dpkg -i dynolog_0.3.2-0-amd64.deb
)
rm -rf "${DYNOLOG_TMP}"
fi
uv pip install --system --no-cache-dir --no-deps --index-strategy unsafe-best-match \
-r $HOME/python_depset.lock
# Install awscli v2
AWSCLI_TMP="$(mktemp -d)"
(
cd "${AWSCLI_TMP}"
curl -sfL "https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
sudo ./aws/install
)
rm -rf "${AWSCLI_TMP}"
# Cleanup unused packages and caches.
$HOME/anaconda3/bin/conda clean -y -all
# Work around for https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/45234
sudo mkdir -p /var/run/sshd
# Configure ssh port
echo Port $SSH_PORT | sudo tee -a /etc/ssh/sshd_config
if [[ ! -d /usr/local/cuda ]]; then
EFA_VERSION="1.42.0"
GDRCOPY_VERSION=""
AWS_OFI_NCCL_VERSION=""
elif [[ -d "/usr/local/cuda-11" ]]; then
EFA_VERSION="1.28.0"
GDRCOPY_VERSION="2.4"
AWS_OFI_NCCL_VERSION="1.7.3-aws"
elif [[ -d "/usr/local/cuda-12" ]]; then
EFA_VERSION="1.42.0"
GDRCOPY_VERSION="2.5"
AWS_OFI_NCCL_VERSION="1.15.0"
elif [[ -d "/usr/local/cuda-13" ]]; then
EFA_VERSION="1.42.0"
GDRCOPY_VERSION="2.5.1"
AWS_OFI_NCCL_VERSION="1.18.0"
else
echo "Unsupported CUDA major version"
exit 1
fi
# Install EFA
wget -q "https://efa-installer.amazonaws.com/aws-efa-installer-${EFA_VERSION}.tar.gz" -O "/tmp/aws-efa-installer-${EFA_VERSION}.tar.gz"
wget -q "https://efa-installer.amazonaws.com/aws-efa-installer.key" -O /tmp/aws-efa-installer.key && gpg --import /tmp/aws-efa-installer.key
gpg --fingerprint </tmp/aws-efa-installer.key
wget -q "https://efa-installer.amazonaws.com/aws-efa-installer-${EFA_VERSION}.tar.gz.sig" -O "/tmp/aws-efa-installer-${EFA_VERSION}.tar.gz.sig"
gpg --verify "/tmp/aws-efa-installer-${EFA_VERSION}.tar.gz.sig"
tar -xzf "/tmp/aws-efa-installer-${EFA_VERSION}.tar.gz" -C /tmp
(cd /tmp/aws-efa-installer; sudo bash efa_installer.sh --yes --skip-kmod)
rm -rf "/tmp/aws-efa-installer-${EFA_VERSION}.tar.gz" /tmp/aws-efa-installer.key /tmp/aws-efa-installer
# Install GDRCopy
if [[ "${GDRCOPY_VERSION}" != "" ]]; then
echo "Installing gdrcopy for GPU images"
sudo apt-get -y install build-essential devscripts debhelper check libsubunit-dev fakeroot pkg-config dkms
wget -q "https://github.com/NVIDIA/gdrcopy/archive/refs/tags/v${GDRCOPY_VERSION}.tar.gz" -O "/tmp/v${GDRCOPY_VERSION}.tar.gz"
tar -xzf "/tmp/v${GDRCOPY_VERSION}.tar.gz" -C /tmp
(
cd "/tmp/gdrcopy-${GDRCOPY_VERSION}"
sudo make -j`nproc` lib_install
)
rm -rf "/tmp/gdrcopy-${GDRCOPY_VERSION}"
else
echo "Skip installing gdrcopy"
fi
# Install AWS OFI NCCL
if [[ "${AWS_OFI_NCCL_VERSION}" != "" ]]; then
echo "Installing aws-ofi-nccl"
sudo apt-get install -y autoconf libhwloc-dev
(
cd /tmp
git clone --depth=1 "https://github.com/aws/aws-ofi-nccl.git" -b "v${AWS_OFI_NCCL_VERSION}"
)
(
cd /tmp/aws-ofi-nccl
./autogen.sh
./configure --with-libfabric=/opt/amazon/efa \
--with-mpi=/opt/amazon/openmpi \
--with-cuda=/usr/local/cuda \
--with-nccl=/usr/local --prefix=/usr/local
make -j`nproc`
sudo make install
)
rm -rf /tmp/aws-ofi-nccl
else
echo "Skip installing aws-ofi-nccl"
fi
# Remove apt sources so that it won't run into apt update issues when running
# the image.
sudo rm -rf /etc/apt/sources.list.d/*
sudo rm -rf /var/lib/apt/lists/*
EOF
RUN mkdir -p /tmp/supervisord
+10
View File
@@ -0,0 +1,10 @@
name: "$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base-extra$ARCH_SUFFIX"
froms: ["cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base$ARCH_SUFFIX"]
dockerfile: docker/base-extra/Dockerfile
srcs:
- python/deplocks/base_extra/ray_base_extra_py$PYTHON_VERSION.lock
build_args:
- BASE_IMAGE=cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base$ARCH_SUFFIX
- PYTHON_VERSION
tags:
- cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cpu-base-extra$ARCH_SUFFIX
+10
View File
@@ -0,0 +1,10 @@
name: "$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base-extra$ARCH_SUFFIX"
froms: ["cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base$ARCH_SUFFIX"]
dockerfile: docker/base-extra/Dockerfile
srcs:
- python/deplocks/base_extra/ray_base_extra_py$PYTHON_VERSION.lock
build_args:
- BASE_IMAGE=cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base$ARCH_SUFFIX
- PYTHON_VERSION
tags:
- cr.ray.io/rayproject/$IMAGE_TYPE-py$PYTHON_VERSION-cu$CUDA_VERSION-base-extra$ARCH_SUFFIX
+11
View File
@@ -0,0 +1,11 @@
azure-identity
datasketches
jupyterlab
ipywidgets
grpcio
grpcio-tools
jupyter_server_terminals
# [backend] is for installing anyscale CLI for use in the anyscale cloud.
anyscale[backend]>=0.26.74
+137
View File
@@ -0,0 +1,137 @@
# syntax=docker/dockerfile:1.3-labs
# This Dockerfile is used to build the slim Ray image
# Mainly for use on Anyscale.
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ARG PYTHON_VERSION="3.10"
ARG PYTHON_DEPSET="python/deplocks/base_slim/ray_base_slim_py${PYTHON_VERSION}.lock"
ARG CONSTRAINTS_FILE="python/requirements_compiled_py${PYTHON_VERSION}.txt"
RUN <<EOF
#!/bin/bash
set -euo pipefail
set -x
export DEBIAN_FRONTEND=noninteractive
APT_PKGS=(
ca-certificates
netbase
tzdata
curl
sudo
openssh-client
openssh-server
rsync
zip
unzip
git
gdb
vim-tiny
less
)
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends "${APT_PKGS[@]}"
rm -rf /var/lib/apt/lists/*
useradd -ms /bin/bash -d /home/ray ray --uid 1000 --gid 100
usermod -aG sudo ray
echo 'ray ALL=NOPASSWD: ALL' >> /etc/sudoers
# Install uv
curl -sSL -o- https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL="/usr/local/bin" sh
# Determine the architecture of the host
if [[ "${HOSTTYPE}" =~ ^x86_64 ]]; then
ARCH="x86_64"
elif [[ "${HOSTTYPE}" =~ ^aarch64 ]]; then
ARCH="aarch64"
else
echo "Unsupported architecture ${HOSTTYPE}" >/dev/stderr
exit 1
fi
# Install dynolog
if [[ "$ARCH" == "x86_64" ]]; then
DYNOLOG_TMP="$(mktemp -d)"
(
cd "${DYNOLOG_TMP}"
curl -sSL https://github.com/facebookincubator/dynolog/releases/download/v0.3.2/dynolog_0.3.2-0-amd64.deb -o dynolog_0.3.2-0-amd64.deb
sudo dpkg -i dynolog_0.3.2-0-amd64.deb
)
rm -rf "${DYNOLOG_TMP}"
fi
# Install azcopy
AZCOPY_VERSION="10.30.0"
AZCOPY_TMP="$(mktemp -d)"
(
cd "${AZCOPY_TMP}"
if [[ "$ARCH" == "x86_64" ]]; then
curl -sSfL "https://github.com/Azure/azure-storage-azcopy/releases/download/v${AZCOPY_VERSION}/azcopy_linux_amd64_${AZCOPY_VERSION}.tar.gz" \
-o- | tar -xz "azcopy_linux_amd64_${AZCOPY_VERSION}/azcopy"
sudo mv "azcopy_linux_amd64_${AZCOPY_VERSION}/azcopy" /usr/local/bin/azcopy
else
curl -sSfL "https://github.com/Azure/azure-storage-azcopy/releases/download/v${AZCOPY_VERSION}/azcopy_linux_arm64_${AZCOPY_VERSION}.tar.gz" \
-o- | tar -xz "azcopy_linux_arm64_${AZCOPY_VERSION}/azcopy"
sudo mv "azcopy_linux_arm64_${AZCOPY_VERSION}/azcopy" /usr/local/bin/azcopy
fi
)
rm -rf "${AZCOPY_TMP}"
# Install awscli
AWSCLI_TMP="$(mktemp -d)"
(
cd "${AWSCLI_TMP}"
curl -sfL "https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
sudo ./aws/install
)
rm -rf "${AWSCLI_TMP}"
aws --version
EOF
# Switch to ray user
USER ray
ENV HOME=/home/ray
WORKDIR /home/ray
COPY "$CONSTRAINTS_FILE" /home/ray/requirements_compiled.txt
COPY "$PYTHON_DEPSET" /home/ray/python_depset.lock
RUN <<EOF
#!/bin/bash
set -euo pipefail
set -x
MINIFORGE_VERSION="24.11.3-0"
# Install miniforge
MINIFORGE_LINK="https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-${MINIFORGE_VERSION}-Linux-${HOSTTYPE}.sh"
curl -sfL -o /tmp/miniforge.sh "${MINIFORGE_LINK}"
bash /tmp/miniforge.sh -b -p /home/ray/anaconda3 # use anaconda3 to match existing images to avoid surprises.
rm /tmp/miniforge.sh
/home/ray/anaconda3/bin/conda init bash
eval "$(/home/ray/anaconda3/bin/conda shell.bash activate)"
/home/ray/anaconda3/bin/conda install -y "python=${PYTHON_VERSION}"
/home/ray/anaconda3/bin/conda clean -a
uv pip install --system --no-cache-dir --no-deps --index-strategy unsafe-best-match \
-r $HOME/python_depset.lock
anyscale --version
mkdir -p /tmp/supervisord
EOF
ENV PATH="/home/ray/.local/bin:/home/ray/anaconda3/bin:$PATH"
CMD ["bash"]
+12
View File
@@ -0,0 +1,12 @@
name: "ray-slim-py$PYTHON_VERSION-cpu-base$ARCH_SUFFIX"
froms: ["ubuntu:22.04"]
dockerfile: docker/base-slim/Dockerfile
srcs:
- python/requirements_compiled.txt
- python/requirements_compiled_py$PYTHON_VERSION.txt
- python/deplocks/base_slim/ray_base_slim_py$PYTHON_VERSION.lock
build_args:
- PYTHON_VERSION
- BASE_IMAGE=ubuntu:22.04
tags:
- cr.ray.io/rayproject/ray-slim-py$PYTHON_VERSION-cpu-base$ARCH_SUFFIX
+12
View File
@@ -0,0 +1,12 @@
name: "ray-slim-py$PYTHON_VERSION-cu$CUDA_VERSION-base$ARCH_SUFFIX"
froms: ["nvidia/cuda:$CUDA_VERSION-runtime-ubuntu22.04"]
dockerfile: docker/base-slim/Dockerfile
srcs:
- python/requirements_compiled.txt
- python/requirements_compiled_py$PYTHON_VERSION.txt
- python/deplocks/base_slim/ray_base_slim_py$PYTHON_VERSION.lock
build_args:
- PYTHON_VERSION
- BASE_IMAGE=nvidia/cuda:$CUDA_VERSION-runtime-ubuntu22.04
tags:
- cr.ray.io/rayproject/ray-slim-py$PYTHON_VERSION-cu$CUDA_VERSION-base$ARCH_SUFFIX
+10
View File
@@ -0,0 +1,10 @@
anyscale
packaging
azure-identity
adlfs[abfs]
boto3
google-cloud-storage
jupyterlab
ipywidgets
supervisor
smart_open[s3,gcs,azure,http]
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
IMAGE="1.7.0"
if [ $# -eq 0 ]
then
echo "Please Specify the release tag (i.e. 1.7.0)"
exit 1
fi
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--release-tag)
shift
IMAGE=$1
;;
*)
echo "Usage: fix-docker-latest.sh --release-tag <TAG>"
exit 1
esac
shift
done
ASSUME_ROLE_CREDENTIALS=$(aws sts assume-role --role-arn arn:aws:iam::"$(aws sts get-caller-identity | jq -r .Account)":role/InvokeDockerTagLatest --role-session-name push_latest)
AWS_ACCESS_KEY_ID=$(echo "$ASSUME_ROLE_CREDENTIALS" | jq -r .Credentials.AccessKeyId)
AWS_SECRET_ACCESS_KEY=$(echo "$ASSUME_ROLE_CREDENTIALS" | jq -r .Credentials.SecretAccessKey)
AWS_SESSION_TOKEN=$(echo "$ASSUME_ROLE_CREDENTIALS" | jq -r .Credentials.SessionToken)
echo -e "Invoking this lambda!\nView logs at https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logsV2:log-groups"
AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN AWS_SECURITY_TOKEN='' aws \
lambda invoke --function-name DockerTagLatest \
--cli-binary-format raw-in-base64-out \
--cli-read-timeout 600 \
--payload "{\"source_tag\" : \"$IMAGE\", \"destination_tag\" : \"latest\"}" /dev/stdout
echo -e "Please check logs before rerunning!!!!\n\nAt the time of writing, Autoscaler Images are not built.\nSo retagging errors for those images are expected!"
+108
View File
@@ -0,0 +1,108 @@
# syntax=docker/dockerfile:1.3-labs
ARG BASE_IMAGE
FROM "$BASE_IMAGE"
COPY python/deplocks/llm/rayllm_*.lock ./
COPY python/requirements/llm/patches/vllm-device-aware-compile-cache.patch ./
# vLLM version tag to use for EP kernel and DeepGEMM install scripts
# Keep in sync with vllm version in python/requirements/llm/llm-requirements.txt
ARG VLLM_SCRIPTS_REF="v0.24.0"
# Pin DeepEP to the V1 (NVSHMEM) commit that vLLM's own release image uses. The
# install script's default drifted to DeepEP V2 ("NCCL Gin"), which needs
# NCCL >= 2.30.4, but our image has nvidia-nccl-cu13==2.28.9 (via torch) so V2
# fails to build. Keep in sync with DEEPEP_COMMIT_HASH in vllm's docker/Dockerfile.
ARG DEEPEP_COMMIT_HASH="73b6ea4"
RUN <<EOF
#!/bin/bash
set -euo pipefail
PYTHON_CODE="$(python -c "import sys; v=sys.version_info; print(f'py{v.major}{v.minor}')")"
if [[ "${PYTHON_CODE}" == "py312" ]]; then
CUDA_CODE=cu130
# Use nvshmem 3.3.24 which is the default for vLLM and compatible with CUDA 13
# https://github.com/vllm-project/vllm/blob/64ac1395e8d52e3e38910a62c7eb8524126730d8/tools/ep_kernels/install_python_libraries.sh#L14
NVSHMEM_VER=3.3.24
else
echo "ray-llm supports Python 3.12 only (this image is ${PYTHON_CODE})."
exit 1
fi
# Hash verification is disabled because uv pip compile generates hashes from
# PyPI, but unsafe-best-match may download from the CUDA index which serves
# different builds of some packages (e.g. triton). The lock file still pins
# exact versions, so integrity is maintained through version pinning.
uv pip install --system --no-cache-dir --no-deps \
--index-strategy unsafe-best-match \
--no-verify-hashes \
-r "rayllm_${PYTHON_CODE}_${CUDA_CODE}.lock"
# Include the CUDA device index in vLLM's compile cache paths so a worker never
# reloads a torch.compile artifact built for a different physical GPU.
# TODO (jeffreywang): Remove this patch once https://github.com/vllm-project/vllm/pull/38962 lands.
VLLM_DEVICE_AWARE_COMPILE_CACHE_PATCH="$(pwd)/vllm-device-aware-compile-cache.patch"
VLLM_SITE_PACKAGES="$(python - <<'PY'
import site
import sysconfig
from pathlib import Path
candidate_dirs = [
Path(sysconfig.get_paths()["purelib"]),
Path(sysconfig.get_paths()["platlib"]),
*(Path(path) for path in site.getsitepackages()),
]
for base_dir in dict.fromkeys(candidate_dirs):
import_utils = base_dir / "vllm" / "utils" / "import_utils.py"
if import_utils.exists():
print(base_dir)
break
else:
raise SystemExit("vLLM import_utils.py not found")
PY
)"
(
cd "${VLLM_SITE_PACKAGES}"
git apply "${VLLM_DEVICE_AWARE_COMPILE_CACHE_PATCH}"
)
sudo apt-get update -y && sudo apt-get install -y curl kmod pkg-config librdmacm-dev cmake
# Fetch and run vLLM install scripts at pinned commit
VLLM_RAW="https://raw.githubusercontent.com/vllm-project/vllm/${VLLM_SCRIPTS_REF}"
# Tell uv to use system Python since the vLLM scripts use uv
export UV_SYSTEM_PYTHON=1
# Set CUDA architectures for building EP kernels
# EP kernels + DeepGEMM require Hopper+ features (matches vLLM Dockerfile)
export TORCH_CUDA_ARCH_LIST="9.0a 10.0a"
# Install EP kernels (PPLX, DeepEP, and NVSHMEM)
# Pin --deepep-ref to the V1 NVSHMEM-backend commit (see DEEPEP_COMMIT_HASH above);
# the script's own default is the V2 NCCL-Gin backend that fails to compile here.
curl -fsSL "${VLLM_RAW}/tools/ep_kernels/install_python_libraries.sh" | \
bash -s -- --workspace /home/ray/llm_ep_support --nvshmem-ver ${NVSHMEM_VER} --deepep-ref ${DEEPEP_COMMIT_HASH}
# Install DeepGEMM
curl -fsSL "${VLLM_RAW}/tools/install_deepgemm.sh" | bash
# Export installed packages
$HOME/anaconda3/bin/pip freeze > /home/ray/pip-freeze.txt
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get clean
EOF
# vLLM 0.21.0 selects the FlashInfer top-k/top-p sampler during engine initialization
# instead of the previous PyTorch-native/Triton sampling path. The FlashInfer sampler
# introduces longer adds a large one-time engine initialization cost. To avoid performance
# surprises, we disable the FlashInfer sampler by default.
ENV VLLM_USE_FLASHINFER_SAMPLER=0
+11
View File
@@ -0,0 +1,11 @@
name: "ray-llm-py$PYTHON_VERSION-cu$CUDA_VERSION-base"
froms: ["cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cu$CUDA_VERSION-base"]
dockerfile: docker/ray-llm/Dockerfile
srcs:
- python/requirements.txt
- python/deplocks/llm/rayllm_py312_cu130.lock
- python/requirements/llm/patches/vllm-device-aware-compile-cache.patch
build_args:
- BASE_IMAGE=cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cu$CUDA_VERSION-base
tags:
- cr.ray.io/rayproject/ray-llm-py$PYTHON_VERSION-cu$CUDA_VERSION-base
+19
View File
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1.3-labs
ARG BASE_IMAGE
ARG FULL_BASE_IMAGE=rayproject/ray:nightly"$BASE_IMAGE"
FROM "$FULL_BASE_IMAGE"
COPY python/*requirements.txt \
python/requirements/ml/*requirements.txt \
python/requirements/docker/*requirements.txt ./
COPY docker/ray-ml/install-ml-docker-requirements.sh ./
RUN sudo chmod +x install-ml-docker-requirements.sh \
&& ./install-ml-docker-requirements.sh
# Export installed packages
RUN $HOME/anaconda3/bin/pip freeze > /home/ray/pip-freeze.txt
# Make sure tfp is installed correctly and matches tf version.
RUN python -c "import tensorflow_probability"
+34
View File
@@ -0,0 +1,34 @@
## About
This image is an extension of the [`rayproject/ray`](https://hub.docker.com/repository/docker/rayproject/ray) image. It includes all extended requirements of `RLlib`, `Serve` and `Tune`. It is a well-provisioned starting point for trying out the Ray ecosystem. [Find the Dockerfile here.](https://github.com/ray-project/ray/blob/master/docker/ray-ml/Dockerfile)
## Tags
Images are `tagged` with the format `{Ray version}[-{Python version}][-{Platform}]`. `Ray version` tag can be one of the following:
| Ray version tag | Description |
| --------------- | ----------- |
| `latest` | The most recent Ray release. |
| `x.y.z` | A specific Ray release, e.g. 2.9.3 |
| `nightly` | The most recent Ray development build (a recent commit from GitHub `master`) |
The optional `Python version` tag specifies the Python version in the image. All Python versions supported by Ray are available, e.g. `py39`, `py310` and `py311`. If unspecified, the tag points to an image using `Python 3.9`.
The optional `Platform` tag specifies the platform where the image is intended for:
| Platform tag | Description |
| --------------- | ----------- |
| `-cpu` | These are based off of an Ubuntu image. |
| `-cuXX` | These are based off of an NVIDIA CUDA image with the specified CUDA version `xx`. They require the NVIDIA Docker Runtime. |
| `-gpu` | Aliases to a specific `-cuXX` tagged image. |
| no tag | Aliases to `-cpu` tagged images for `ray`, and aliases to ``-gpu`` tagged images for `ray-ml`. |
Examples tags:
- none: equivalent to `latest`
- `latest`: equivalent to `latest-py39-gpu`, i.e. image for the most recent Ray release
- `nightly-py39-cpu`
- `806c18-py39-cu112`
The `ray-ml` images are not built for the `arm64` (`aarch64`) architecture.
## Other Images
* [`rayproject/ray`](https://hub.docker.com/repository/docker/rayproject/ray) - Ray and all of its dependencies.
+21
View File
@@ -0,0 +1,21 @@
name: "ray-ml-py$PYTHON_VERSION-cpu-base"
froms: ["cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cpu-base"]
dockerfile: docker/ray-ml/Dockerfile
srcs:
- python/requirements.txt
- python/requirements/ml/dl-cpu-requirements.txt
- python/requirements/ml/dl-gpu-requirements.txt
- python/requirements/ml/core-requirements.txt
- python/requirements/ml/data-requirements.txt
- python/requirements/ml/rllib-requirements.txt
- python/requirements/ml/rllib-test-requirements.txt
- python/requirements/ml/train-requirements.txt
- python/requirements/ml/train-test-requirements.txt
- python/requirements/ml/tune-requirements.txt
- python/requirements/ml/tune-test-requirements.txt
- python/requirements/docker/ray-docker-requirements.txt
- docker/ray-ml/install-ml-docker-requirements.sh
build_args:
- FULL_BASE_IMAGE=cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cpu-base
tags:
- cr.ray.io/rayproject/ray-ml-py$PYTHON_VERSION-cpu-base
+21
View File
@@ -0,0 +1,21 @@
name: "ray-ml-py$PYTHON_VERSION-cu$CUDA_VERSION-base"
froms: ["cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cu$CUDA_VERSION-base"]
dockerfile: docker/ray-ml/Dockerfile
srcs:
- python/requirements.txt
- python/requirements/ml/dl-cpu-requirements.txt
- python/requirements/ml/dl-gpu-requirements.txt
- python/requirements/ml/core-requirements.txt
- python/requirements/ml/data-requirements.txt
- python/requirements/ml/rllib-requirements.txt
- python/requirements/ml/rllib-test-requirements.txt
- python/requirements/ml/train-requirements.txt
- python/requirements/ml/train-test-requirements.txt
- python/requirements/ml/tune-requirements.txt
- python/requirements/ml/tune-test-requirements.txt
- python/requirements/docker/ray-docker-requirements.txt
- docker/ray-ml/install-ml-docker-requirements.sh
build_args:
- FULL_BASE_IMAGE=cr.ray.io/rayproject/ray-py$PYTHON_VERSION-cu$CUDA_VERSION-base
tags:
- cr.ray.io/rayproject/ray-ml-py$PYTHON_VERSION-cu$CUDA_VERSION-base
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
set -e
# shellcheck disable=SC2139
alias pip="$HOME/anaconda3/bin/pip"
sudo apt-get update \
&& sudo apt-get install -y gcc \
cmake \
libgtk2.0-dev \
libgl1-mesa-dev \
libgl1-mesa-glx \
libosmesa6 \
libosmesa6-dev \
libglfw3 \
patchelf \
unzip \
unrar \
zlib1g-dev
# Install requirements
pip --no-cache-dir install -r requirements.txt -c requirements_compiled.txt
# Install other requirements. Keep pinned requirements bounds as constraints
pip --no-cache-dir install \
-c requirements.txt \
-c requirements_compiled.txt \
-r dl-cpu-requirements.txt \
-r core-requirements.txt \
-r data-requirements.txt \
-r rllib-requirements.txt \
-r rllib-test-requirements.txt \
-r train-requirements.txt \
-r train-test-requirements.txt \
-r tune-requirements.txt \
-r tune-test-requirements.txt \
-r ray-docker-requirements.txt
# Remove any device-specific constraints from requirements_compiled.txt.
# E.g.: torch-scatter==2.1.1+pt20cpu or torchvision==0.15.2+cpu
# These are replaced with gpu-specific requirements in dl-gpu-requirements.txt.
# Also remove pandas and cupy-cuda12x pins so cudf-cu12 dependencies can resolve.
sed "/[0-9]\+cpu/d;/[0-9]\+pt/d;/^pandas==/d;/^cupy-cuda12x==/d" "requirements_compiled.txt" > requirements_compiled_gpu.txt
# explicitly install (overwrite) pytorch with CUDA support
pip --no-cache-dir install \
-c requirements.txt \
-c requirements_compiled_gpu.txt \
-r dl-gpu-requirements.txt
sudo apt-get clean
# requirements_compiled.txt will be kept.
sudo rm ./*requirements.txt requirements_compiled_gpu.txt
# MuJoCo Installation.
export MUJOCO_GL=osmesa
wget https://github.com/google-deepmind/mujoco/releases/download/2.1.1/mujoco-2.1.1-linux-x86_64.tar.gz
mkdir -p ~/.mujoco
mv mujoco-2.1.1-linux-x86_64.tar.gz ~/.mujoco/.
cd ~/.mujoco || exit
tar -xf ~/.mujoco/mujoco-2.1.1-linux-x86_64.tar.gz
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:/root/.mujoco/mujoco-2.1.1/bin
+18
View File
@@ -0,0 +1,18 @@
# syntax=docker/dockerfile:1.3-labs
ARG BASE_IMAGE
ARG FULL_BASE_IMAGE=rayproject/ray-deps:nightly"$BASE_IMAGE"
FROM $FULL_BASE_IMAGE
ARG WHEEL_PATH
ARG FIND_LINKS_PATH=".whl"
ARG CONSTRAINTS_FILE="requirements_compiled.txt"
COPY $WHEEL_PATH .
COPY $FIND_LINKS_PATH $FIND_LINKS_PATH
RUN $HOME/anaconda3/bin/pip --no-cache-dir install -c $CONSTRAINTS_FILE \
`basename $WHEEL_PATH`[all] \
--find-links $FIND_LINKS_PATH && sudo rm `basename $WHEEL_PATH`
RUN $HOME/anaconda3/bin/pip freeze > /home/ray/pip-freeze.txt
+52
View File
@@ -0,0 +1,52 @@
Official container images for [Ray](https://github.com/ray-project/ray).
These images contains working Python virtual environments and required
dependencies to run launche Ray nodes and form Ray clusters.
everything needed to get started with running Ray. One can use the images
for local development, or launch clusters with [Ray VM launcher][vm-launcher],
[KubeRay][kuberay], or running them on [Anyscale][anyscale].
Source that builds the images are [here][source].
[vm-launcher]: https://docs.ray.io/en/latest/cluster/vms/index.html
[kuberay]: https://ray-project.github.io/kuberay/
[anyscale]: https://www.anyscale.com/
[source]: https://github.com/ray-project/ray/blob/master/docker/ray/Dockerfile
## Tags
Images are `tagged` with the format
`{Ray version}[-{Python version}][-{Platform}][-{Architecture}]`.
`Ray version` tag can be one of the following:
| Ray version tag | Description |
| --------------- | ----------- |
| `latest` | The most recent Ray release. |
| `x.y.z` | A specific Ray release version, e.g. 2.53.0 |
| `nightly` | The most recent Ray development build (a recent commit from GitHub `master`) |
The optional `Python version` tag specifies the Python version in the image.
All Python versions supported by Ray are available, e.g. `py310`, `py311`, and
`py312`. If unspecified, the tag points to an image using `Python 3.10`.
The optional `Platform` tag specifies the platform where the image is intended
for:
| Platform tag | Description |
| --------------- | ----------- |
| `-cpu` | Based off of an Ubuntu image. |
| `-cuXX` | Based off of an NVIDIA CUDA image with the specified CUDA version `xx`. They require the NVIDIA Docker Runtime. |
| `-gpu` | Aliases to a specific `-cuXX` tagged image. |
| no tag | Aliases to `-cpu` tagged images. |
The optional `Architecture` tag can be used to specify images for different CPU
architectures. Currently, we support the `x86_64` (`amd64`) and `aarch64`
(`arm64`) architectures.
Please note that suffixes are only used to specify `aarch64` images.
No suffix means that it is a multi-platform image index.
| Platform tag | Description |
|--------------|-----------------------------|
| no tag | Multi-platform image index. |
| `-aarch64` | arm64-compatible images |
+16
View File
@@ -0,0 +1,16 @@
# Updating this Lambda Function
1. Get Docker Retag via wget:
```
pushd docker/retag-lambda
wget -q https://github.com/joshdk/docker-retag/releases/download/0.0.2/docker-retag
popd
```
2. Package this folder:
```
pushd docker/retag-lambda
zip retag-lambda.zip *
```
3. Head to the AWS Management console & select the `DockerTagLatest` function. Select `Upload from`, then `.zip file` and then select the zip file created in Step 2.
+7
View File
@@ -0,0 +1,7 @@
cu128
cu125
cu124
cu123
cu121
cu118
cu117
+96
View File
@@ -0,0 +1,96 @@
import json
import os
import subprocess
import boto3
DOCKER_USER = None
DOCKER_PASS = None
def _get_curr_dir():
return os.path.dirname(os.path.realpath(__file__))
def get_secrets():
global DOCKER_PASS, DOCKER_USER
secret_name = "dockerRetagLatestCredentials"
region_name = "us-west-2"
session = boto3.session.Session()
client = session.client(service_name="secretsmanager", region_name=region_name)
get_secret_value_response = client.get_secret_value(SecretId=secret_name)
secret_string = get_secret_value_response["SecretString"]
dct = json.loads(secret_string)
DOCKER_PASS = dct["DOCKER_PASS"]
DOCKER_USER = dct["DOCKER_USER"]
def retag(repo: str, source: str, destination: str) -> str:
global DOCKER_PASS, DOCKER_USER
if DOCKER_PASS is None or DOCKER_USER is None:
get_secrets()
assert (
DOCKER_PASS is not None and DOCKER_USER is not None
), "Docker Username or Password not set()"
return subprocess.run(
["./docker-retag", f"rayproject/{repo}:{source}", destination],
env={"DOCKER_USER": DOCKER_USER, "DOCKER_PASS": DOCKER_PASS},
)
def parse_versions(version_file):
with open(version_file) as f:
file_versions = f.read().splitlines()
return file_versions
def lambda_handler(event, context):
source_image = event["source_tag"]
destination_image = event["destination_tag"]
total_results = []
python_versions = parse_versions(
os.path.join(_get_curr_dir(), "python_versions.txt")
)
cuda_versions = parse_versions(os.path.join(_get_curr_dir(), "cuda_versions.txt"))
for repo in ["ray", "ray-ml"]:
results = []
# For example tag ray:1.X-py3.7-cu112 to ray:latest-py3.7-cu112
for pyversion in python_versions:
source_tag = f"{source_image}-{pyversion}"
destination_tag = f"{destination_image}-{pyversion}"
for cudaversion in cuda_versions:
cuda_source_tag = source_tag + f"-{cudaversion}"
cuda_destination_tag = destination_tag + f"-{cudaversion}"
results.append(retag(repo, cuda_source_tag, cuda_destination_tag))
# Tag ray:1.X-py3.7 to ray:latest-py3.7
results.append(retag(repo, source_tag, destination_tag))
# Tag ray:1.X-py3.7-cpu to ray:latest-py3.7-cpu
results.append(retag(repo, source_tag + "-cpu", destination_tag + "-cpu"))
# Tag ray:1.X-py3.7-gpu to ray:latest-py3.7-gpu
results.append(retag(repo, source_tag + "-gpu", destination_tag + "-gpu"))
[print(i) for i in results]
total_results.extend(results)
# Retag images without a python version specified (defaults to py39)
results = []
for repo in ["ray", "ray-ml", "ray-deps", "base-deps"]:
# For example tag ray:1.X-cu112 to ray:latest-cu112
for cudaversion in cuda_versions:
source_tag = f"{source_image}-{cudaversion}"
destination_tag = f"{destination_image}-{cudaversion}"
results.append(retag(repo, source_tag, destination_tag))
# Tag ray:1.X to ray:latest
results.append(retag(repo, source_image, destination_image))
# Tag ray:1.X-cpu to ray:latest-cpu
results.append(retag(repo, source_image + "-cpu", destination_image + "-cpu"))
# Tag ray:1.X-gpu to ray:latest-gpu
results.append(retag(repo, source_image + "-gpu", destination_image + "-gpu"))
[print(i) for i in results]
total_results.extend(results)
if all(r.returncode == 0 for r in total_results):
return {"statusCode": 200, "body": json.dumps("Retagging Complete!")}
else:
return {"statusCode": 500, "body": json.dumps("Retagging Broke!!")}
+4
View File
@@ -0,0 +1,4 @@
py38
py39
py310
py311