From 2e33ed3ba0d254e63db7b896483ae8fefbe8acd5 Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Tue, 8 Oct 2024 17:40:06 +0800 Subject: [PATCH] Modified download_deps.py (#2747) ### What problem does this PR solve? Modified download_deps.py ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [x] Other (please describe): CI --- .github/workflows/tests.yml | 2 +- Dockerfile | 5 +++-- download_deps.py | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4ea516b58..982323d90 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: - name: Build ragflow:dev-slim run: | RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME} - cp -r ${RUNNER_WORKSPACE_PREFIX}/huggingface.co ${RUNNER_WORKSPACE_PREFIX}/nltk_data . + cp -r ${RUNNER_WORKSPACE_PREFIX}/huggingface.co ${RUNNER_WORKSPACE_PREFIX}/nltk_data ${RUNNER_WORKSPACE_PREFIX}/libssl*.deb . sudo docker pull ubuntu:24.04 sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim . diff --git a/Dockerfile b/Dockerfile index c9418b154..61a8cc27e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,8 +24,9 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13 # aspose-slides on linux/arm64 is unavailable -RUN if [ "${ARCH}" = "amd64" ]; then \ - curl -o libssl1.deb http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb && dpkg -i libssl1.deb && rm -f libssl1.deb; \ +RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \ + if [ "${ARCH}" = "amd64" ]; then \ + dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \ fi ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 diff --git a/download_deps.py b/download_deps.py index 8f855f366..ab8fafb2f 100644 --- a/download_deps.py +++ b/download_deps.py @@ -3,6 +3,11 @@ from huggingface_hub import snapshot_download import nltk import os +import urllib.request + +urls = [ + "http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb", +] repos = [ "InfiniFlow/text_concat_xgb_v1.0", @@ -20,6 +25,12 @@ def download_model(repo_id): if __name__ == "__main__": + for url in urls: + filename = url.split("/")[-1] + print(f"Downloading {url}...") + if not os.path.exists(filename): + urllib.request.urlretrieve(url, filename) + local_dir = os.path.abspath('nltk_data') for data in ['wordnet', 'punkt', 'punkt_tab']: print(f"Downloading nltk {data}...")