Skip to content

Commit

Permalink
enhance: for arm-based gpu image (#31830)
Browse files Browse the repository at this point in the history
pr: #31757

Signed-off-by: Liang Huang <[email protected]>
  • Loading branch information
yellow-shine authored Apr 3, 2024
1 parent 0b3f087 commit 3c14c8a
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
43 changes: 43 additions & 0 deletions build/docker/builder/gpu/ubuntu22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 as builder

ARG TARGETARCH

RUN apt-get update && apt-get install -y --no-install-recommends wget curl ca-certificates gnupg2 ninja-build && \
wget -qO- "https://cmake.org/files/v3.27/cmake-3.27.5-linux-`uname -m`.tar.gz" | tar --strip-components=1 -xz -C /usr/local && \
apt-get update && apt-get install -y --no-install-recommends \
g++ gcc gfortran git make ccache libssl-dev zlib1g-dev zip unzip \
clang-format clang-tidy lcov libtool m4 autoconf automake python3 python3-pip \
pkg-config uuid-dev libaio-dev libgoogle-perftools-dev libopenblas-dev && \
apt-get remove --purge -y && \
rm -rf /var/lib/apt/lists/*


# Install go
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.20.7.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go
# Install conan
RUN pip3 install conan==1.61.0
# Install rust
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain=1.73 -y
ENV PATH=/root/.cargo/bin:/usr/local/bin:/usr/local/go/bin:$PATH

RUN mkdir /opt/vcpkg && \
wget -qO- vcpkg.tar.gz https://github.com/microsoft/vcpkg/archive/master.tar.gz | tar --strip-components=1 -xz -C /opt/vcpkg && \
rm -rf vcpkg.tar.gz
ENV VCPKG_FORCE_SYSTEM_BINARIES 1
RUN /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && ln -s /opt/vcpkg/vcpkg /usr/local/bin/vcpkg && vcpkg version
RUN vcpkg install azure-identity-cpp azure-storage-blobs-cpp gtest


# refer: https://code.visualstudio.com/docs/remote/containers-advanced#_avoiding-extension-reinstalls-on-container-rebuild
RUN mkdir -p /home/milvus/.vscode-server/extensions \
/home/milvus/.vscode-server-insiders/extensions \
&& chmod -R 777 /home/milvus



RUN wget -O /tini https://github.com/krallin/tini/releases/download/v0.19.0/tini-$TARGETARCH && \
chmod +x /tini



25 changes: 25 additions & 0 deletions build/docker/milvus/gpu/ubuntu22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04

ARG TARGETARCH

RUN apt-get update && \
apt-get install -y --no-install-recommends curl ca-certificates libaio-dev libgomp1 libopenblas-dev && \
apt-get remove --purge -y && \
rm -rf /var/lib/apt/lists/*

COPY --chown=root:root --chmod=774 ./bin/ /milvus/bin/
COPY --chown=root:root --chmod=774 ./configs/ /milvus/configs/
COPY --chown=root:root --chmod=774 ./lib/ /milvus/lib/

ENV PATH=/milvus/bin:$PATH
ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib
ENV LD_PRELOAD=/milvus/lib/libjemalloc.so
ENV MALLOC_CONF=background_thread:true

# Add Tini
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-$TARGETARCH /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]

WORKDIR /milvus

64 changes: 64 additions & 0 deletions ci/jenkins/PublishArmBasedGPUImages.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env groovy

pipeline {
agent {
label 'arm'
}

options {
timestamps()
timeout(time: 300, unit: 'MINUTES')
// parallelsAlwaysFailFast()
disableConcurrentBuilds()
}

environment {
DOCKER_CREDENTIALS_ID = "dockerhub"
DOCKER_BUILDKIT = 1
TARGET_REPO = "milvusdb"
CI_DOCKER_CREDENTIAL_ID = "harbor-milvus-io-registry"
HARBOR_REPO = "harbor.milvus.io"
}

stages {
stage('Publish Milvus GPU Images'){

steps {
script {
sh """
docker run -v \$(pwd):/root/milvus -v \$(pwd)/.docker/.conan:/root/.conan -w /root/milvus milvusdb/milvus-env:gpu-ubuntu22.04-20240330-4021fhl-arm64 sh -c "make clean && make gpu-install"
"""

def date = sh(returnStdout: true, script: 'date +%Y%m%d').trim()
def gitShortCommit = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()

withCredentials([usernamePassword(credentialsId: "${env.DOCKER_CREDENTIALS_ID}", usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
sh 'docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}'
sh """
export MILVUS_IMAGE_REPO="${env.TARGET_REPO}/milvus"
export MILVUS_HARBOR_IMAGE_REPO="${env.HARBOR_REPO}/milvus/milvus"
export MILVUS_IMAGE_TAG="${env.BRANCH_NAME}-${date}-${gitShortCommit}-gpu-arm"
docker build --build-arg TARGETARCH=arm64 -f "./build/docker/milvus/gpu/ubuntu22.04/Dockerfile" -t \${MILVUS_IMAGE_REPO}:\${MILVUS_IMAGE_TAG} .
docker push \${MILVUS_IMAGE_REPO}:\${MILVUS_IMAGE_TAG}
docker tag \${MILVUS_IMAGE_REPO}:\${MILVUS_IMAGE_TAG} \${MILVUS_HARBOR_IMAGE_REPO}:\${MILVUS_IMAGE_TAG}
docker logout
"""
}

withCredentials([usernamePassword(credentialsId: "${env.CI_DOCKER_CREDENTIAL_ID}", usernameVariable: 'CI_REGISTRY_USERNAME', passwordVariable: 'CI_REGISTRY_PASSWORD')]){
sh "docker login ${env.HARBOR_REPO} -u '${CI_REGISTRY_USERNAME}' -p '${CI_REGISTRY_PASSWORD}'"
sh """
export MILVUS_HARBOR_IMAGE_REPO="${env.HARBOR_REPO}/milvus/milvus"
export MILVUS_IMAGE_TAG="${env.BRANCH_NAME}-${date}-${gitShortCommit}-gpu-arm"
docker push \${MILVUS_HARBOR_IMAGE_REPO}:\${MILVUS_IMAGE_TAG}
docker logout
"""
}
}
}
}
}

}

0 comments on commit 3c14c8a

Please sign in to comment.