From 52cd9171023e023ef38a6c4c2c1b90306d955585 Mon Sep 17 00:00:00 2001 From: junjiejiangjjj Date: Mon, 27 May 2024 14:39:09 +0800 Subject: [PATCH] Build milvus lite in docker (#144) Signed-off-by: junjie.jiang --- scripts/Dockerfile | 29 +++++++++++++++++++++++++++++ scripts/README.md | 7 +++++++ scripts/build.sh | 33 +++++++++++++++++++++++++++++++++ scripts/build_milvus_lite.sh | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 scripts/Dockerfile create mode 100644 scripts/README.md create mode 100644 scripts/build.sh create mode 100644 scripts/build_milvus_lite.sh diff --git a/scripts/Dockerfile b/scripts/Dockerfile new file mode 100644 index 0000000..15d30fe --- /dev/null +++ b/scripts/Dockerfile @@ -0,0 +1,29 @@ +# Copyright (C) 2019-2020 Zilliz. 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. + + +FROM quay.io/pypa/manylinux_2_28_x86_64 + +RUN yum install -y openblas-devel libatomic-static git && cp /usr/lib/gcc/x86_64-redhat-linux/8/libatomic.a /usr/lib64/ +ENV PATH="/opt/_internal/cpython-3.8.19/bin:${PATH}" +RUN pip3 install conan==1.63.0 +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +RUN mkdir -p /workspace +WORKDIR /workspace + +RUN conan remote add default-conan-local https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local + +COPY build_milvus_lite.sh /workspace/build_milvus_lite.sh +RUN chmod +x /workspace/build_milvus_lite.sh + +ENTRYPOINT ["/workspace/build_milvus_lite.sh"] \ No newline at end of file diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..0ce3929 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,7 @@ +# Build Milvus-Lite In Docker + +## build commond + +```shell + build.sh ${TAG} {$CONAN_CACHE} +``` diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..cd6a692 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Licensed to the LF AI & Data foundation under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +TAG="main" + +if [ "$#" -eq 0 ]; then + docker build -t build_milvus_lite:$TAG . \ + && docker run --rm -v $PWD:/workspace/dist build_milvus_lite:$TAG $TAG +elif [ "$#" -eq 1 ]; then + TAG=$1 + docker build -t build_milvus_lite:$TAG . \ + && docker run --rm -v $PWD:/workspace/dist build_milvus_lite:$TAG $TAG +elif [ "$#" -eq 2 ]; then + TAG=$1 + CACAN_CACHE=$2 + docker build -t build_milvus_lite:$TAG . \ + && docker run --rm -e CONAN_USER_HOME=/workspace/conan -v $CACAN_CACHE:/workspace/conan -v $PWD:/workspace/dist build_milvus_lite:$TAG $TAG +fi diff --git a/scripts/build_milvus_lite.sh b/scripts/build_milvus_lite.sh new file mode 100644 index 0000000..ff199d8 --- /dev/null +++ b/scripts/build_milvus_lite.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Licensed to the LF AI & Data foundation under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +tag="main" + +if [ "$#" -eq 1 ]; then + tag=$1 +fi + +echo "Build milvus-lite:$tag" +echo $CONAN_USER_HOME + +git clone --recurse-submodules https://github.com/milvus-io/milvus-lite.git \ + && cd milvus-lite \ + && git checkout $tag \ + && cd python \ + && python3 setup.py bdist_wheel \ + && cp -r dist /workspace/ \ + && cd /workspace && rm -rf milvus-lite