build multi-arch image (#2710)

### 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
This commit is contained in:
Zhichang Yu 2024-10-03 21:00:26 +08:00 committed by GitHub
parent 7f2ee3bbe9
commit abe9995a7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 26 deletions

View File

@ -48,7 +48,8 @@ jobs:
- name: Build ragflow:dev-slim - name: Build ragflow:dev-slim
run: | run: |
RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME} RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
cp -r ${RUNNER_WORKSPACE_PREFIX}/huggingface.co ${RUNNER_WORKSPACE_PREFIX}/nltk_data ${RUNNER_WORKSPACE_PREFIX}/*.tar.gz . cp -r ${RUNNER_WORKSPACE_PREFIX}/huggingface.co ${RUNNER_WORKSPACE_PREFIX}/nltk_data .
sudo docker pull ubuntu:24.04
sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim . sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
- name: Build ragflow:dev - name: Build ragflow:dev

View File

@ -2,6 +2,7 @@
FROM ubuntu:24.04 AS base FROM ubuntu:24.04 AS base
USER root USER root
ARG ARCH=amd64
ENV LIGHTEN=0 ENV LIGHTEN=0
WORKDIR /ragflow WORKDIR /ragflow
@ -21,13 +22,11 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked
&& pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \ && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \ # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf \ # aspose-slides on linux/arm64 is unavailable
&& echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf \ RUN if [ "${ARCH}" = "amd64" ]; then \
&& cd /root && tar xzf openssl-1.1.1w.tar.gz \ 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; \
&& cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl11 --openssldir=/usr/local/openssl11 shared \ fi
&& make -j && make install \
&& ldconfig && cd /root && rm -rf openssl-1.1.1w
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

View File

@ -2,6 +2,7 @@
FROM ubuntu:24.04 AS base FROM ubuntu:24.04 AS base
USER root USER root
ARG ARCH=amd64
ENV LIGHTEN=1 ENV LIGHTEN=1
WORKDIR /ragflow WORKDIR /ragflow
@ -21,13 +22,11 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked
&& pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \ && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \ # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf \ # aspose-slides on linux/arm64 is unavailable
&& echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf \ RUN if [ "${ARCH}" = "amd64" ]; then \
&& cd /root && tar xzf openssl-1.1.1w.tar.gz \ 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; \
&& cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl11 --openssldir=/usr/local/openssl11 shared \ fi
&& make -j && make install \
&& ldconfig && cd /root && rm -rf openssl-1.1.1w
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

View File

@ -3,11 +3,6 @@
from huggingface_hub import snapshot_download from huggingface_hub import snapshot_download
import nltk import nltk
import os import os
import urllib.request
urls = [
"https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz",
]
repos = [ repos = [
"InfiniFlow/text_concat_xgb_v1.0", "InfiniFlow/text_concat_xgb_v1.0",
@ -25,12 +20,6 @@ def download_model(repo_id):
if __name__ == "__main__": 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') local_dir = os.path.abspath('nltk_data')
for data in ['wordnet', 'punkt', 'punkt_tab']: for data in ['wordnet', 'punkt', 'punkt_tab']:
print(f"Downloading nltk {data}...") print(f"Downloading nltk {data}...")