diff --git a/IndexSDK/Dockerfile/Dockerfile-ascendbase-infer.txt b/IndexSDK/Dockerfile/Dockerfile-ascendbase-infer.txt index a85b135e2791aebbe965f836a531ef102fdd6fd7..16a9838230719f1021d1e0c331eb50b4b3273384 100644 --- a/IndexSDK/Dockerfile/Dockerfile-ascendbase-infer.txt +++ b/IndexSDK/Dockerfile/Dockerfile-ascendbase-infer.txt @@ -1,12 +1,13 @@ FROM ubuntu:18.04 WORKDIR /tmp COPY install_deps.sh ./ +COPY ./urls.conf ./ # TODO RUN chmod 777 /tmp # 系统包 + Pip3.9 -RUN cp -a /etc/apt/sources.list /etc/apt/sources.list.bak && \ - sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list && \ - sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list +RUN . ./urls.conf && cp -a /etc/apt/sources.list /etc/apt/sources.list.bak && \ + sed -i "$ARCHIVE_DOCKR" /etc/apt/sources.list && \ + sed -i "$SECRITY_DOCKR" /etc/apt/sources.list RUN apt update && \ apt install --no-install-recommends ca-certificates -y && \ apt install --no-install-recommends wget vim dos2unix net-tools ssh lsof sshpass -y && \ @@ -16,7 +17,7 @@ RUN apt update && \ apt install --no-install-recommends zlib1g-dev xz-utils libgmpxx4ldbl -y && \ apt clean && rm -rf /var/lib/apt/lists/* # 安装Python -RUN wget https://repo.huaweicloud.com/python/3.9.11/Python-3.9.11.tar.xz && \ +RUN . ./urls.conf && wget $PYTHON_DOCKR && \ tar -xf Python-3.9.11.tar.xz && \ cd Python-3.9.11 && \ mkdir build && cd build && \ @@ -26,10 +27,10 @@ RUN wget https://repo.huaweicloud.com/python/3.9.11/Python-3.9.11.tar.xz && \ ldconfig ENV PATH=$PATH:/usr/local/python3.9.11/bin \ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/python3.9.11/lib -RUN mkdir ~/.pip && touch ~/.pip/pip.conf && \ +RUN . ./urls.conf && mkdir ~/.pip && touch ~/.pip/pip.conf && \ echo "[global]" > ~/.pip/pip.conf && \ echo "trusted-host=mirrors.aliyun.com" >> ~/.pip/pip.conf && \ - echo "index-url=http://mirrors.aliyun.com/pypi/simple" >> ~/.pip/pip.conf && \ + echo "index-url=$INDEX_DOCKR" >> ~/.pip/pip.conf && \ echo "timeout=200" >> ~/.pip/pip.conf # python包 RUN pip3.9 install -U pip && \ @@ -47,7 +48,7 @@ RUN pip3.9 install -U pip && \ rm -rf /root/.cache/pip # 安装cmake -RUN wget https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1.tar.gz && \ +RUN . ./urls.conf && wget $CMAKE_DOCKR && \ tar xf cmake-3.23.1.tar.gz && cd cmake-3.23.1 && ./configure --prefix=/usr && \ make -j && make -j install && cd .. && rm -rf cmake-3.23.1* && bash install_deps.sh # 清理临时目录 diff --git a/IndexSDK/Dockerfile/install_deps.sh b/IndexSDK/Dockerfile/install_deps.sh index 268f6fffc990f16db679e4479b6734abb88cf096..29db4cd5d514fe236d907768498ca727be222198 100644 --- a/IndexSDK/Dockerfile/install_deps.sh +++ b/IndexSDK/Dockerfile/install_deps.sh @@ -1,5 +1,7 @@ +set -e +. ./urls.conf # OpenBLAS -wget https://github.com/xianyi/OpenBLAS/archive/v0.3.10.tar.gz -O OpenBLAS-0.3.10.tar.gz +wget ${OpenBLAS_SH} -O OpenBLAS-0.3.10.tar.gz tar -xf OpenBLAS-0.3.10.tar.gz cd OpenBLAS-0.3.10 make FC=gfortran USE_OPENMP=1 -j @@ -9,7 +11,7 @@ cd .. && rm -f OpenBLAS-0.3.10.tar.gz && rm -rf OpenBLAS-0.3.10 # faiss 1.7.4 install_path=/usr/local/faiss/faiss1.7.4 -wget https://github.com/facebookresearch/faiss/archive/v1.7.4.tar.gz -O faiss-1.7.4.tar.gz +wget ${FAISS_SH} -O faiss-1.7.4.tar.gz tar -xf faiss-1.7.4.tar.gz && cd faiss-1.7.4/faiss arch="$(uname -m)" @@ -52,7 +54,7 @@ cmake -B build . -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DBUILD_TESTIN cd build && make -j && make install cd ../.. && rm -rf faiss-1.7.4* -wget https://github.com/google/googletest/archive/refs/tags/release-1.8.1.tar.gz && \ +wget ${RELEASE_SH} && \ cp release-1.8.1.tar.gz /tmp/googletest-release-1.8.1.tar.gz && \ tar xf release-1.8.1.tar.gz && cd googletest-release-1.8.1 && \ cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local/gtest . && make -j && make install && \ diff --git a/IndexSDK/Dockerfile/urls.conf b/IndexSDK/Dockerfile/urls.conf new file mode 100644 index 0000000000000000000000000000000000000000..dfc67ca6f92ae5c9d841e1aa6ff715ff970b607b --- /dev/null +++ b/IndexSDK/Dockerfile/urls.conf @@ -0,0 +1,8 @@ +OpenBLAS_SH=https://github.com/xianyi/OpenBLAS/archive/v0.3.10.tar.gz +FAISS_SH=https://github.com/facebookresearch/faiss/archive/v1.7.4.tar.gz +RELEASE_SH=https://github.com/google/googletest/archive/refs/tags/release-1.8.1.tar.gz +PYTHON_DOCKR=https://repo.huaweicloud.com/python/3.9.11/Python-3.9.11.tar.xz +CMAKE_DOCKR=https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1.tar.gz +INDEX_DOCKR=http://mirrors.aliyun.com/pypi/simple +ARCHIVE_DOCKR=s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g +SECRITY_DOCKR=s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g \ No newline at end of file diff --git a/IndexSDK/faiss-python/setup.py b/IndexSDK/faiss-python/setup.py index 815a486fca87cdabc0c6eae646f15d18559b5c41..11529f5b7a7522c490190557b049007c920f51d8 100644 --- a/IndexSDK/faiss-python/setup.py +++ b/IndexSDK/faiss-python/setup.py @@ -39,7 +39,6 @@ setup( version='1.0.0', description='A library for efficient similarity search and clustering of dense vectors', long_description=DESCRIPTION, - url='https://www.huawei.com', author='Huawei', author_email='', license='MIT',