zhichyu commited on
Commit
4f95287
·
1 Parent(s): 79717ac

build multi-arch image (#2710)

Browse files

### What problem does this PR solve?
build multi-arch image

### 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 CHANGED
@@ -48,7 +48,8 @@ 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 ${RUNNER_WORKSPACE_PREFIX}/*.tar.gz .
 
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 .
52
+ sudo docker pull ubuntu:24.04
53
  sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
54
 
55
  - name: Build ragflow:dev
Dockerfile CHANGED
@@ -2,6 +2,7 @@
2
  FROM ubuntu:24.04 AS base
3
  USER root
4
 
 
5
  ENV LIGHTEN=0
6
 
7
  WORKDIR /ragflow
@@ -21,13 +22,11 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked
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
 
 
2
  FROM ubuntu:24.04 AS base
3
  USER root
4
 
5
+ ARG ARCH=amd64
6
  ENV LIGHTEN=0
7
 
8
  WORKDIR /ragflow
 
22
  && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
+ # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
26
+ # aspose-slides on linux/arm64 is unavailable
27
+ RUN if [ "${ARCH}" = "amd64" ]; then \
28
+ 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; \
29
+ fi
 
 
30
 
31
  ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
32
 
Dockerfile.slim CHANGED
@@ -2,6 +2,7 @@
2
  FROM ubuntu:24.04 AS base
3
  USER root
4
 
 
5
  ENV LIGHTEN=1
6
 
7
  WORKDIR /ragflow
@@ -21,13 +22,11 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked
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
 
 
2
  FROM ubuntu:24.04 AS base
3
  USER root
4
 
5
+ ARG ARCH=amd64
6
  ENV LIGHTEN=1
7
 
8
  WORKDIR /ragflow
 
22
  && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
+ # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
26
+ # aspose-slides on linux/arm64 is unavailable
27
+ RUN if [ "${ARCH}" = "amd64" ]; then \
28
+ 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; \
29
+ fi
 
 
30
 
31
  ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
32
 
download_deps.py CHANGED
@@ -3,11 +3,6 @@
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,12 +20,6 @@ def download_model(repo_id):
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}...")
 
3
  from huggingface_hub import snapshot_download
4
  import nltk
5
  import os
 
 
 
 
 
6
 
7
  repos = [
8
  "InfiniFlow/text_concat_xgb_v1.0",
 
20
 
21
 
22
  if __name__ == "__main__":
 
 
 
 
 
 
23
  local_dir = os.path.abspath('nltk_data')
24
  for data in ['wordnet', 'punkt', 'punkt_tab']:
25
  print(f"Downloading nltk {data}...")