Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge miniforge-cuda into ci-imgs #167

Merged
merged 11 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 2 additions & 0 deletions .github/workflows/build-and-publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
PYTHON_VER: ${{ matrix.PYTHON_VER }}
IMAGE_REPO: ${{ matrix.IMAGE_REPO }}
IMAGE_NAME: ${{ matrix.IMAGE_NAME }}
DOCKERFILE: ${{ matrix.DOCKERFILE }}
DOCKER_TARGET: ${{ matrix.DOCKER_TARGET }}
build-multiarch-manifest:
name: manifest (${{ matrix.CUDA_VER }}, ${{ matrix.PYTHON_VER }}, ${{ matrix.LINUX_VER }}, ${{ matrix.IMAGE_REPO }})
needs: [docker, compute-matrix]
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ on:
IMAGE_NAME:
required: true
type: string
DOCKERFILE:
required: true
type: string
DOCKER_TARGET:
required: false
type: string

jobs:
run:
Expand Down Expand Up @@ -62,9 +68,10 @@ jobs:
uses: docker/build-push-action@v6
with:
context: context
file: ${{ inputs.IMAGE_REPO }}.Dockerfile
file: ${{ inputs.DOCKERFILE }}
push: true
pull: true
build-args: |
${{ steps.generate-build-args.outputs.ARGS }}
target: ${{ inputs.DOCKER_TARGET }}
tags: ${{ inputs.IMAGE_NAME }}-${{ matrix.ARCH }}
79 changes: 73 additions & 6 deletions ci-conda.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,88 @@
ARG CUDA_VER=notset
ARG LINUX_VER=notset
ARG PYTHON_VER=notset
ARG YQ_VER
ARG AWS_CLI_VER
ARG YQ_VER=notset
ARG AWS_CLI_VER=notset

FROM mikefarah/yq:${YQ_VER} as yq
FROM nvidia/cuda:${CUDA_VER}-base-${LINUX_VER} AS miniforge-cuda

FROM amazon/aws-cli:${AWS_CLI_VER} as aws-cli
ARG LINUX_VER
ARG PYTHON_VER
ARG DEBIAN_FRONTEND=noninteractive
ENV PATH=/opt/conda/bin:$PATH
ENV PYTHON_VERSION=${PYTHON_VER}

SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

# Create a conda group and assign it as root's primary group
RUN <<EOF
groupadd conda
usermod -g conda root
EOF

# Ownership & permissions based on https://docs.anaconda.com/anaconda/install/multi-user/#multi-user-anaconda-installation-on-linux
COPY --from=condaforge/miniforge3:24.3.0-0 --chown=root:conda --chmod=770 /opt/conda /opt/conda

FROM rapidsai/miniforge-cuda:cuda${CUDA_VER}-base-${LINUX_VER}-py${PYTHON_VER}
# Ensure new files are created with group write access & setgid. See https://unix.stackexchange.com/a/12845
RUN chmod g+ws /opt/conda

RUN <<EOF
# Ensure new files/dirs have group write permissions
umask 002
# install expected Python version
conda install -y -n base "python~=${PYTHON_VERSION}.0=*_cpython"
conda update --all -y -n base
if [[ "$LINUX_VER" == "rockylinux"* ]]; then
yum install -y findutils
yum clean all
fi
find /opt/conda -follow -type f -name '*.a' -delete
find /opt/conda -follow -type f -name '*.pyc' -delete
conda clean -afy
EOF

# Reassign root's primary group to root
RUN usermod -g root root

RUN <<EOF
# ensure conda environment is always activated
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
echo ". /opt/conda/etc/profile.d/conda.sh; conda activate base" >> /etc/skel/.bashrc
echo ". /opt/conda/etc/profile.d/conda.sh; conda activate base" >> ~/.bashrc
EOF

# tzdata is needed by the ORC library used by pyarrow, because it provides /etc/localtime
RUN <<EOF
case "${LINUX_VER}" in
"ubuntu"*)
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends \
tzdata
rm -rf "/var/lib/apt/lists/*"
;;
"rockylinux"*)
yum update -y
yum clean all
;;
*)
echo "Unsupported LINUX_VER: ${LINUX_VER}" && exit 1
;;
esac
EOF

FROM mikefarah/yq:${YQ_VER} AS yq

FROM amazon/aws-cli:${AWS_CLI_VER} AS aws-cli

FROM miniforge-cuda

ARG TARGETPLATFORM
ARG CUDA_VER
ARG LINUX_VER
ARG PYTHON_VER

ARG DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_FRONTEND

# Set RAPIDS versions env variables
ENV RAPIDS_CUDA_VERSION="${CUDA_VER}"
Expand Down
4 changes: 2 additions & 2 deletions ci-wheel.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ARG CUDA_VER=notset
ARG LINUX_VER=notset

ARG BASE_IMAGE=nvcr.io/nvidia/cuda:${CUDA_VER}-devel-${LINUX_VER}
ARG AWS_CLI_VER
ARG AWS_CLI_VER=notset

FROM amazon/aws-cli:${AWS_CLI_VER} as aws-cli
FROM amazon/aws-cli:${AWS_CLI_VER} AS aws-cli

FROM ${BASE_IMAGE}

Expand Down
18 changes: 8 additions & 10 deletions ci/compute-matrix.jq
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
def compute_arch($x):
["amd64"] |
if
(["ubuntu18.04", "centos7"] | index($x.LINUX_VER) != null)
then
.
else
. + ["arm64"]
end |
$x + {ARCHES: .};
$x + {ARCHES: ["amd64", "arm64"]};

def compute_repo($x):
if
Expand All @@ -30,7 +22,9 @@ def compute_tag_prefix($x):
def compute_image_name($x):
compute_repo($x) as $repo |
compute_tag_prefix($x) as $tag_prefix |
"rapidsai/" + $repo + ":" + $tag_prefix + "cuda" + $x.CUDA_VER + "-" + $x.LINUX_VER + "-" + "py" + $x.PYTHON_VER |
(if $x.IMAGE_REPO == "miniforge-cuda"
then "-base-" else "-" end) as $base_id |
"rapidsai/" + $repo + ":" + $tag_prefix + "cuda" + $x.CUDA_VER + $base_id + $x.LINUX_VER + "-" + "py" + $x.PYTHON_VER |
$x + {IMAGE_NAME: .};

# Checks the current entry to see if it matches the given exclude
Expand All @@ -54,6 +48,10 @@ def compute_matrix($input):
[
combinations |
lists2dict($matrix_keys; .) |
.IMAGE_REPO = .CI_IMAGE_CONFIG.IMAGE_REPO |
.DOCKERFILE = .CI_IMAGE_CONFIG.dockerfile |
.DOCKER_TARGET = .CI_IMAGE_CONFIG.docker_target |
del(.CI_IMAGE_CONFIG) |
filter_excludes(.; $excludes) |
compute_arch(.) |
compute_image_name(.)
Expand Down
11 changes: 3 additions & 8 deletions ci/create-multiarch-manifest.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#!/bin/bash
set -euo pipefail

PREFIX="conda"
if [[ "${IMAGE_REPO}" != "ci-conda" ]]; then
PREFIX="wheels"
fi

LATEST_CUDA_VER=$(yq -r ".$PREFIX.CUDA_VER" latest.yaml)
LATEST_PYTHON_VER=$(yq -r ".$PREFIX.PYTHON_VER" latest.yaml)
LATEST_UBUNTU_VER=$(yq -r ".$PREFIX.LINUX_VER" latest.yaml)
LATEST_CUDA_VER=$(yq -r ".${IMAGE_REPO}.CUDA_VER" latest.yaml)
LATEST_PYTHON_VER=$(yq -r ".${IMAGE_REPO}.PYTHON_VER" latest.yaml)
LATEST_UBUNTU_VER=$(yq -r ".${IMAGE_REPO}.LINUX_VER" latest.yaml)

source_tags=()
tag="${IMAGE_NAME}"
Expand Down
4 changes: 2 additions & 2 deletions citestwheel.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ARG CUDA_VER=notset
ARG LINUX_VER=notset

ARG BASE_IMAGE=nvcr.io/nvidia/cuda:${CUDA_VER}-devel-${LINUX_VER}
ARG AWS_CLI_VER
ARG AWS_CLI_VER=notset

FROM amazon/aws-cli:${AWS_CLI_VER} as aws-cli
FROM amazon/aws-cli:${AWS_CLI_VER} AS aws-cli

FROM ${BASE_IMAGE}

Expand Down
12 changes: 10 additions & 2 deletions latest.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Define the values used for the "latest" tag
conda:
miniforge-cuda:
CUDA_VER: "12.2.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update all these to 12.5. But that can be a follow-up PR.

PYTHON_VER: "3.11"
LINUX_VER: "ubuntu22.04"
wheels:
ci-conda:
CUDA_VER: "12.2.2"
PYTHON_VER: "3.11"
LINUX_VER: "ubuntu22.04"
ci-wheel:
CUDA_VER: "12.2.2"
PYTHON_VER: "3.11"
LINUX_VER: "ubuntu20.04"
citestwheel:
CUDA_VER: "12.2.2"
PYTHON_VER: "3.11"
LINUX_VER: "ubuntu20.04"
17 changes: 13 additions & 4 deletions matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ LINUX_VER:
- "ubuntu20.04"
- "ubuntu22.04"
- "rockylinux8"
IMAGE_REPO:
- "ci-conda"
- "ci-wheel"
- "citestwheel"
CI_IMAGE_CONFIG:
- IMAGE_REPO: "miniforge-cuda"
dockerfile: ci-conda.Dockerfile
docker_target: miniforge-cuda
- IMAGE_REPO: "ci-conda"
dockerfile: ci-conda.Dockerfile
docker_target: ""
- IMAGE_REPO: "ci-wheel"
dockerfile: ci-wheel.Dockerfile
docker_target: ""
- IMAGE_REPO: "citestwheel"
dockerfile: citestwheel.Dockerfile
docker_target: ""
exclude:
# Exclusions from CUDA's OS support matrix
- LINUX_VER: "ubuntu22.04"
Expand Down