zhichyu Ubuntu commited on
Commit
95c3d5f
·
1 Parent(s): 9021f65

Fix Dockerfile for arm64 (#2705)

Browse files

### What problem does this PR solve?

Fix Dockerfile for arm64

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):

---------

Co-authored-by: Ubuntu <[email protected]>

Files changed (5) hide show
  1. .github/workflows/tests.yml +1 -1
  2. Dockerfile +12 -4
  3. Dockerfile.slim +12 -4
  4. docker/.env +1 -1
  5. download_deps.py +13 -1
.github/workflows/tests.yml CHANGED
@@ -48,7 +48,7 @@ jobs:
48
  - name: Build ragflow:dev-slim
49
  run: |
50
  RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
51
- cp -r ${RUNNER_WORKSPACE_PREFIX}/huggingface.co ${RUNNER_WORKSPACE_PREFIX}/nltk_data .
52
  sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
53
 
54
  - name: Build ragflow:dev
 
48
  - name: Build ragflow:dev-slim
49
  run: |
50
  RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
51
+ cp -r ${RUNNER_WORKSPACE_PREFIX}/huggingface.co ${RUNNER_WORKSPACE_PREFIX}/nltk_data ${RUNNER_WORKSPACE_PREFIX}/*.tar.gz .
52
  sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
53
 
54
  - name: Build ragflow:dev
Dockerfile CHANGED
@@ -12,14 +12,22 @@ RUN rm -f /etc/apt/apt.conf.d/docker-clean \
12
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
13
  apt update && apt-get --no-install-recommends install -y ca-certificates
14
 
15
- # if you located in China, you can use tsinghua mirror to speed up apt
16
- RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
 
17
 
18
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
19
- apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
- 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
 
 
 
 
 
 
23
 
24
  ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
25
 
 
12
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
13
  apt update && apt-get --no-install-recommends install -y ca-certificates
14
 
15
+ # If you are at mainland China, you can use tsinghua mirror to speed up apt and poetry
16
+ RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
17
+ ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/
18
 
19
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
20
+ apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-pip python3-poetry \
21
+ && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
+ RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \
25
+ echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf \
26
+ && echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf \
27
+ && cd /root && tar xzf openssl-1.1.1w.tar.gz \
28
+ && cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl11 --openssldir=/usr/local/openssl11 shared \
29
+ && make -j && make install \
30
+ && ldconfig && cd /root && rm -rf openssl-1.1.1w
31
 
32
  ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
33
 
Dockerfile.slim CHANGED
@@ -12,14 +12,22 @@ RUN rm -f /etc/apt/apt.conf.d/docker-clean \
12
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
13
  apt update && apt-get --no-install-recommends install -y ca-certificates
14
 
15
- # if you located in China, you can use tsinghua mirror to speed up apt
16
- RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
 
17
 
18
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
19
- apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
- 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
 
 
 
 
 
 
23
 
24
  ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
25
 
 
12
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
13
  apt update && apt-get --no-install-recommends install -y ca-certificates
14
 
15
+ # If you are at mainland China, you can use tsinghua mirror to speed up apt and poetry
16
+ RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
17
+ ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/
18
 
19
  RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
20
+ apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-pip python3-poetry \
21
+ && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
+ RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \
25
+ echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf \
26
+ && echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf \
27
+ && cd /root && tar xzf openssl-1.1.1w.tar.gz \
28
+ && cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl11 --openssldir=/usr/local/openssl11 shared \
29
+ && make -j && make install \
30
+ && ldconfig && cd /root && rm -rf openssl-1.1.1w
31
 
32
  ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
33
 
docker/.env CHANGED
@@ -33,7 +33,7 @@ REDIS_PASSWORD=infini_rag_flow
33
 
34
  SVR_HTTP_PORT=9380
35
 
36
- RAGFLOW_IMAGE=infiniflow/ragflow:dev-slim
37
 
38
  # If inside mainland China, decomment either of the following hub.docker.com mirrors:
39
  # RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:dev-slim
 
33
 
34
  SVR_HTTP_PORT=9380
35
 
36
+ RAGFLOW_IMAGE=infiniflow/ragflow:dev
37
 
38
  # If inside mainland China, decomment either of the following hub.docker.com mirrors:
39
  # RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:dev-slim
download_deps.py CHANGED
@@ -3,6 +3,11 @@
3
  from huggingface_hub import snapshot_download
4
  import nltk
5
  import os
 
 
 
 
 
6
 
7
  repos = [
8
  "InfiniFlow/text_concat_xgb_v1.0",
@@ -20,10 +25,17 @@ def download_model(repo_id):
20
 
21
 
22
  if __name__ == "__main__":
 
 
 
 
 
 
23
  local_dir = os.path.abspath('nltk_data')
24
- for data in ['wordnet', 'punkt', 'wordnet']:
25
  print(f"Downloading nltk {data}...")
26
  nltk.download(data, download_dir=local_dir)
 
27
  for repo_id in repos:
28
  print(f"Downloading huggingface repo {repo_id}...")
29
  download_model(repo_id)
 
3
  from huggingface_hub import snapshot_download
4
  import nltk
5
  import os
6
+ import urllib.request
7
+
8
+ urls = [
9
+ "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz",
10
+ ]
11
 
12
  repos = [
13
  "InfiniFlow/text_concat_xgb_v1.0",
 
25
 
26
 
27
  if __name__ == "__main__":
28
+ for url in urls:
29
+ filename = url.split("/")[-1]
30
+ print(f"Downloading {url}...")
31
+ if not os.path.exists(filename):
32
+ urllib.request.urlretrieve(url, filename)
33
+
34
  local_dir = os.path.abspath('nltk_data')
35
+ for data in ['wordnet', 'punkt', 'punkt_tab']:
36
  print(f"Downloading nltk {data}...")
37
  nltk.download(data, download_dir=local_dir)
38
+
39
  for repo_id in repos:
40
  print(f"Downloading huggingface repo {repo_id}...")
41
  download_model(repo_id)