From 3ab88ec16ee41ef73a1f42db1a005552f48535dc Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 2 Oct 2024 02:11:29 +0000 Subject: [PATCH] Fix Dockerfile for arm64 --- Dockerfile | 8 +++++++- Dockerfile.slim | 8 +++++++- download_deps.py | 14 +++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b3c1bfd46a..1b9eba7772 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,13 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \ && rm -rf /var/lib/apt/lists/* -RUN curl -o libssl1.deb http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb && dpkg -i libssl1.deb && rm -f libssl1.deb +RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \ + echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf \ + && echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf \ + && cd /root && tar xzf openssl-1.1.1w.tar.gz \ + && cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl11 --openssldir=/usr/local/openssl11 shared \ + && make -j && make install \ + && ldconfig && cd /root && rm -rf openssl-1.1.1w ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 diff --git a/Dockerfile.slim b/Dockerfile.slim index 8dba333826..e91ef37903 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -19,7 +19,13 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \ && rm -rf /var/lib/apt/lists/* -RUN curl -o libssl1.deb http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb && dpkg -i libssl1.deb && rm -f libssl1.deb +RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \ + echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf \ + && echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf \ + && cd /root && tar xzf openssl-1.1.1w.tar.gz \ + && cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl11 --openssldir=/usr/local/openssl11 shared \ + && make -j && make install \ + && ldconfig && cd /root && rm -rf openssl-1.1.1w ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 diff --git a/download_deps.py b/download_deps.py index 6ff72f6ce1..265515c2b8 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 = [ + "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz", +] repos = [ "InfiniFlow/text_concat_xgb_v1.0", @@ -20,10 +25,17 @@ 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', 'wordnet']: + for data in ['wordnet', 'punkt', 'punkt_tab']: print(f"Downloading nltk {data}...") nltk.download(data, download_dir=local_dir) + for repo_id in repos: print(f"Downloading huggingface repo {repo_id}...") download_model(repo_id)