Skip to content

Commit

Permalink
Build milvus lite in docker (#144)
Browse files Browse the repository at this point in the history
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
  • Loading branch information
junjiejiangjjj authored May 27, 2024
1 parent b7d3e1a commit 52cd917
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
7 changes: 7 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build Milvus-Lite In Docker

## build commond

```shell
build.sh ${TAG} {$CONAN_CACHE}
```
33 changes: 33 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions scripts/build_milvus_lite.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 52cd917

Please sign in to comment.