Improved image build instructions (#3580)
Browse files### What problem does this PR solve?
Improved arm64 image build instructions
### Type of change
- [x] Documentation Update
- [x] Refactoring
- .github/workflows/tests.yml +4 -4
- Dockerfile +29 -6
- Dockerfile.slim +29 -6
- README.md +2 -2
- README_id.md +2 -2
- README_ja.md +2 -2
- README_ko.md +2 -2
- README_zh.md +2 -2
- api/versions.py +35 -14
- build_docker_image.sh +0 -46
- docs/guides/develop/build_docker_image.mdx +2 -2
- download_deps.py +1 -0
.github/workflows/tests.yml
CHANGED
@@ -48,13 +48,13 @@ 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}/libssl*.deb ${RUNNER_WORKSPACE_PREFIX}/tika-server*.jar* .
|
52 |
-
sudo docker pull ubuntu:
|
53 |
-
sudo
|
54 |
|
55 |
- name: Build ragflow:dev
|
56 |
run: |
|
57 |
-
sudo
|
58 |
|
59 |
- name: Start ragflow:dev-slim
|
60 |
run: |
|
|
|
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}/libssl*.deb ${RUNNER_WORKSPACE_PREFIX}/tika-server*.jar* ${RUNNER_WORKSPACE_PREFIX}/chrome* ${RUNNER_WORKSPACE_PREFIX}/cl100k_base.tiktoken .
|
52 |
+
sudo docker pull ubuntu:22.04
|
53 |
+
sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
54 |
|
55 |
- name: Build ragflow:dev
|
56 |
run: |
|
57 |
+
sudo docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
58 |
|
59 |
- name: Start ragflow:dev-slim
|
60 |
run: |
|
Dockerfile
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
# base stage
|
2 |
FROM ubuntu:22.04 AS base
|
3 |
USER root
|
|
|
4 |
|
5 |
-
ARG ARCH=amd64
|
6 |
ENV LIGHTEN=0
|
7 |
|
8 |
WORKDIR /ragflow
|
@@ -18,7 +18,7 @@ RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g'
|
|
18 |
|
19 |
RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
|
20 |
apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx \
|
21 |
-
libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget \
|
22 |
&& rm -rf /var/lib/apt/lists/*
|
23 |
|
24 |
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip3 config set global.trusted-host "pypi.tuna.tsinghua.edu.cn mirrors.pku.edu.cn" && pip3 config set global.extra-index-url "https://mirrors.pku.edu.cn/pypi/web/simple" \
|
@@ -28,8 +28,11 @@ RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple &&
|
|
28 |
# https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
|
29 |
# aspose-slides on linux/arm64 is unavailable
|
30 |
RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
|
31 |
-
|
|
|
32 |
dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \
|
|
|
|
|
33 |
fi
|
34 |
|
35 |
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
@@ -56,6 +59,24 @@ USER root
|
|
56 |
|
57 |
WORKDIR /ragflow
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
COPY web web
|
60 |
COPY docs docs
|
61 |
RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
@@ -65,10 +86,10 @@ RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
|
65 |
COPY pyproject.toml poetry.toml poetry.lock ./
|
66 |
|
67 |
RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
68 |
-
if [ "$LIGHTEN"
|
69 |
-
poetry install --no-root --with=full; \
|
70 |
-
else \
|
71 |
poetry install --no-root; \
|
|
|
|
|
72 |
fi
|
73 |
|
74 |
# production stage
|
@@ -77,6 +98,8 @@ USER root
|
|
77 |
|
78 |
WORKDIR /ragflow
|
79 |
|
|
|
|
|
80 |
# Install python packages' dependencies
|
81 |
# cv2 requires libGL.so.1
|
82 |
RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=locked \
|
|
|
1 |
# base stage
|
2 |
FROM ubuntu:22.04 AS base
|
3 |
USER root
|
4 |
+
SHELL ["/bin/bash", "-c"]
|
5 |
|
|
|
6 |
ENV LIGHTEN=0
|
7 |
|
8 |
WORKDIR /ragflow
|
|
|
18 |
|
19 |
RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
|
20 |
apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx \
|
21 |
+
libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget git \
|
22 |
&& rm -rf /var/lib/apt/lists/*
|
23 |
|
24 |
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip3 config set global.trusted-host "pypi.tuna.tsinghua.edu.cn mirrors.pku.edu.cn" && pip3 config set global.extra-index-url "https://mirrors.pku.edu.cn/pypi/web/simple" \
|
|
|
28 |
# https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
|
29 |
# aspose-slides on linux/arm64 is unavailable
|
30 |
RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
|
31 |
+
--mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_arm64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_arm64.deb \
|
32 |
+
if [ "$(uname -m)" = "x86_64" ]; then \
|
33 |
dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \
|
34 |
+
elif [ "$(uname -m)" = "aarch64" ]; then \
|
35 |
+
dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_arm64.deb; \
|
36 |
fi
|
37 |
|
38 |
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
|
|
59 |
|
60 |
WORKDIR /ragflow
|
61 |
|
62 |
+
COPY .git /ragflow/.git
|
63 |
+
|
64 |
+
RUN current_commit=$(git rev-parse --short HEAD); \
|
65 |
+
last_tag=$(git describe --tags --abbrev=0); \
|
66 |
+
commit_count=$(git rev-list --count "$last_tag..HEAD"); \
|
67 |
+
version_info=""; \
|
68 |
+
if [ "$commit_count" -eq 0 ]; then \
|
69 |
+
version_info=$last_tag; \
|
70 |
+
else \
|
71 |
+
version_info="$current_commit($last_tag~$commit_count)"; \
|
72 |
+
fi; \
|
73 |
+
if [ "$LIGHTEN" == "1" ]; then \
|
74 |
+
version_info="$version_info slim"; \
|
75 |
+
else \
|
76 |
+
version_info="$version_info full"; \
|
77 |
+
fi; \
|
78 |
+
echo $version_info > /ragflow/VERSION
|
79 |
+
|
80 |
COPY web web
|
81 |
COPY docs docs
|
82 |
RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
|
|
86 |
COPY pyproject.toml poetry.toml poetry.lock ./
|
87 |
|
88 |
RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
89 |
+
if [ "$LIGHTEN" == "1" ]; then \
|
|
|
|
|
90 |
poetry install --no-root; \
|
91 |
+
else \
|
92 |
+
poetry install --no-root --with=full; \
|
93 |
fi
|
94 |
|
95 |
# production stage
|
|
|
98 |
|
99 |
WORKDIR /ragflow
|
100 |
|
101 |
+
COPY --from=builder /ragflow/VERSION /ragflow/VERSION
|
102 |
+
|
103 |
# Install python packages' dependencies
|
104 |
# cv2 requires libGL.so.1
|
105 |
RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=locked \
|
Dockerfile.slim
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
# base stage
|
2 |
FROM ubuntu:22.04 AS base
|
3 |
USER root
|
|
|
4 |
|
5 |
-
ARG ARCH=amd64
|
6 |
ENV LIGHTEN=1
|
7 |
|
8 |
WORKDIR /ragflow
|
@@ -18,7 +18,7 @@ RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g'
|
|
18 |
|
19 |
RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
|
20 |
apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx \
|
21 |
-
libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget \
|
22 |
&& rm -rf /var/lib/apt/lists/*
|
23 |
|
24 |
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip3 config set global.trusted-host "pypi.tuna.tsinghua.edu.cn mirrors.pku.edu.cn" && pip3 config set global.extra-index-url "https://mirrors.pku.edu.cn/pypi/web/simple" \
|
@@ -28,8 +28,11 @@ RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple &&
|
|
28 |
# https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
|
29 |
# aspose-slides on linux/arm64 is unavailable
|
30 |
RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
|
31 |
-
|
|
|
32 |
dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \
|
|
|
|
|
33 |
fi
|
34 |
|
35 |
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
@@ -56,6 +59,24 @@ USER root
|
|
56 |
|
57 |
WORKDIR /ragflow
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
COPY web web
|
60 |
COPY docs docs
|
61 |
RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
@@ -65,10 +86,10 @@ RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
|
65 |
COPY pyproject.toml poetry.toml poetry.lock ./
|
66 |
|
67 |
RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
68 |
-
if [ "$LIGHTEN"
|
69 |
-
poetry install --no-root --with=full; \
|
70 |
-
else \
|
71 |
poetry install --no-root; \
|
|
|
|
|
72 |
fi
|
73 |
|
74 |
# production stage
|
@@ -77,6 +98,8 @@ USER root
|
|
77 |
|
78 |
WORKDIR /ragflow
|
79 |
|
|
|
|
|
80 |
# Install python packages' dependencies
|
81 |
# cv2 requires libGL.so.1
|
82 |
RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=locked \
|
|
|
1 |
# base stage
|
2 |
FROM ubuntu:22.04 AS base
|
3 |
USER root
|
4 |
+
SHELL ["/bin/bash", "-c"]
|
5 |
|
|
|
6 |
ENV LIGHTEN=1
|
7 |
|
8 |
WORKDIR /ragflow
|
|
|
18 |
|
19 |
RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
|
20 |
apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx \
|
21 |
+
libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget git \
|
22 |
&& rm -rf /var/lib/apt/lists/*
|
23 |
|
24 |
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip3 config set global.trusted-host "pypi.tuna.tsinghua.edu.cn mirrors.pku.edu.cn" && pip3 config set global.extra-index-url "https://mirrors.pku.edu.cn/pypi/web/simple" \
|
|
|
28 |
# https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
|
29 |
# aspose-slides on linux/arm64 is unavailable
|
30 |
RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
|
31 |
+
--mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_arm64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_arm64.deb \
|
32 |
+
if [ "$(uname -m)" = "x86_64" ]; then \
|
33 |
dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \
|
34 |
+
elif [ "$(uname -m)" = "aarch64" ]; then \
|
35 |
+
dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_arm64.deb; \
|
36 |
fi
|
37 |
|
38 |
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
|
|
59 |
|
60 |
WORKDIR /ragflow
|
61 |
|
62 |
+
COPY .git /ragflow/.git
|
63 |
+
|
64 |
+
RUN current_commit=$(git rev-parse --short HEAD); \
|
65 |
+
last_tag=$(git describe --tags --abbrev=0); \
|
66 |
+
commit_count=$(git rev-list --count "$last_tag..HEAD"); \
|
67 |
+
version_info=""; \
|
68 |
+
if [ "$commit_count" -eq 0 ]; then \
|
69 |
+
version_info=$last_tag; \
|
70 |
+
else \
|
71 |
+
version_info="$current_commit($last_tag~$commit_count)"; \
|
72 |
+
fi; \
|
73 |
+
if [ "$LIGHTEN" == "1" ]; then \
|
74 |
+
version_info="$version_info slim"; \
|
75 |
+
else \
|
76 |
+
version_info="$version_info full"; \
|
77 |
+
fi; \
|
78 |
+
echo $version_info > /ragflow/VERSION
|
79 |
+
|
80 |
COPY web web
|
81 |
COPY docs docs
|
82 |
RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
|
|
86 |
COPY pyproject.toml poetry.toml poetry.lock ./
|
87 |
|
88 |
RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
89 |
+
if [ "$LIGHTEN" == "1" ]; then \
|
|
|
|
|
90 |
poetry install --no-root; \
|
91 |
+
else \
|
92 |
+
poetry install --no-root --with=full; \
|
93 |
fi
|
94 |
|
95 |
# production stage
|
|
|
98 |
|
99 |
WORKDIR /ragflow
|
100 |
|
101 |
+
COPY --from=builder /ragflow/VERSION /ragflow/VERSION
|
102 |
+
|
103 |
# Install python packages' dependencies
|
104 |
# cv2 requires libGL.so.1
|
105 |
RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=locked \
|
README.md
CHANGED
@@ -274,7 +274,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
274 |
cd ragflow/
|
275 |
pip3 install huggingface-hub nltk
|
276 |
python3 download_deps.py
|
277 |
-
|
278 |
```
|
279 |
|
280 |
## 🔧 Build a Docker image including embedding models
|
@@ -286,7 +286,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
286 |
cd ragflow/
|
287 |
pip3 install huggingface-hub nltk
|
288 |
python3 download_deps.py
|
289 |
-
|
290 |
```
|
291 |
|
292 |
## 🔨 Launch service from source for development
|
|
|
274 |
cd ragflow/
|
275 |
pip3 install huggingface-hub nltk
|
276 |
python3 download_deps.py
|
277 |
+
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
278 |
```
|
279 |
|
280 |
## 🔧 Build a Docker image including embedding models
|
|
|
286 |
cd ragflow/
|
287 |
pip3 install huggingface-hub nltk
|
288 |
python3 download_deps.py
|
289 |
+
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
290 |
```
|
291 |
|
292 |
## 🔨 Launch service from source for development
|
README_id.md
CHANGED
@@ -249,7 +249,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
249 |
cd ragflow/
|
250 |
pip3 install huggingface-hub nltk
|
251 |
python3 download_deps.py
|
252 |
-
|
253 |
```
|
254 |
|
255 |
## 🔧 Membangun Docker Image Termasuk Model Embedding
|
@@ -261,7 +261,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
261 |
cd ragflow/
|
262 |
pip3 install huggingface-hub nltk
|
263 |
python3 download_deps.py
|
264 |
-
|
265 |
```
|
266 |
|
267 |
## 🔨 Menjalankan Aplikasi dari untuk Pengembangan
|
|
|
249 |
cd ragflow/
|
250 |
pip3 install huggingface-hub nltk
|
251 |
python3 download_deps.py
|
252 |
+
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
253 |
```
|
254 |
|
255 |
## 🔧 Membangun Docker Image Termasuk Model Embedding
|
|
|
261 |
cd ragflow/
|
262 |
pip3 install huggingface-hub nltk
|
263 |
python3 download_deps.py
|
264 |
+
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
265 |
```
|
266 |
|
267 |
## 🔨 Menjalankan Aplikasi dari untuk Pengembangan
|
README_ja.md
CHANGED
@@ -230,7 +230,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
230 |
cd ragflow/
|
231 |
pip3 install huggingface-hub nltk
|
232 |
python3 download_deps.py
|
233 |
-
|
234 |
```
|
235 |
|
236 |
## 🔧 ソースコードをコンパイルしたDockerイメージ(埋め込みモデルを含む)
|
@@ -242,7 +242,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
242 |
cd ragflow/
|
243 |
pip3 install huggingface-hub nltk
|
244 |
python3 download_deps.py
|
245 |
-
|
246 |
```
|
247 |
|
248 |
## 🔨 ソースコードからサービスを起動する方法
|
|
|
230 |
cd ragflow/
|
231 |
pip3 install huggingface-hub nltk
|
232 |
python3 download_deps.py
|
233 |
+
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
234 |
```
|
235 |
|
236 |
## 🔧 ソースコードをコンパイルしたDockerイメージ(埋め込みモデルを含む)
|
|
|
242 |
cd ragflow/
|
243 |
pip3 install huggingface-hub nltk
|
244 |
python3 download_deps.py
|
245 |
+
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
246 |
```
|
247 |
|
248 |
## 🔨 ソースコードからサービスを起動する方法
|
README_ko.md
CHANGED
@@ -232,7 +232,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
232 |
cd ragflow/
|
233 |
pip3 install huggingface-hub nltk
|
234 |
python3 download_deps.py
|
235 |
-
|
236 |
```
|
237 |
|
238 |
## 🔧 소스 코드로 Docker 이미지를 컴파일합니다(임베딩 모델 포함)
|
@@ -244,7 +244,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
244 |
cd ragflow/
|
245 |
pip3 install huggingface-hub nltk
|
246 |
python3 download_deps.py
|
247 |
-
|
248 |
```
|
249 |
|
250 |
## 🔨 소스 코드로 서비스를 시작합니다.
|
|
|
232 |
cd ragflow/
|
233 |
pip3 install huggingface-hub nltk
|
234 |
python3 download_deps.py
|
235 |
+
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
236 |
```
|
237 |
|
238 |
## 🔧 소스 코드로 Docker 이미지를 컴파일합니다(임베딩 모델 포함)
|
|
|
244 |
cd ragflow/
|
245 |
pip3 install huggingface-hub nltk
|
246 |
python3 download_deps.py
|
247 |
+
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
248 |
```
|
249 |
|
250 |
## 🔨 소스 코드로 서비스를 시작합니다.
|
README_zh.md
CHANGED
@@ -237,7 +237,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
237 |
cd ragflow/
|
238 |
pip3 install huggingface-hub nltk
|
239 |
python3 download_deps.py
|
240 |
-
|
241 |
```
|
242 |
|
243 |
## 🔧 源码编译 Docker 镜像(包含 embedding 模型)
|
@@ -249,7 +249,7 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
249 |
cd ragflow/
|
250 |
pip3 install huggingface-hub nltk
|
251 |
python3 download_deps.py
|
252 |
-
|
253 |
```
|
254 |
|
255 |
## 🔨 以源代码启动服务
|
|
|
237 |
cd ragflow/
|
238 |
pip3 install huggingface-hub nltk
|
239 |
python3 download_deps.py
|
240 |
+
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
241 |
```
|
242 |
|
243 |
## 🔧 源码编译 Docker 镜像(包含 embedding 模型)
|
|
|
249 |
cd ragflow/
|
250 |
pip3 install huggingface-hub nltk
|
251 |
python3 download_deps.py
|
252 |
+
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
253 |
```
|
254 |
|
255 |
## 🔨 以源代码启动服务
|
api/versions.py
CHANGED
@@ -13,26 +13,51 @@
|
|
13 |
# See the License for the specific language governing permissions and
|
14 |
# limitations under the License.
|
15 |
#
|
|
|
|
|
16 |
import subprocess
|
17 |
|
18 |
-
|
19 |
-
return RAGFLOW_VERSION_INFO
|
20 |
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
|
25 |
def get_closest_tag_and_count():
|
26 |
try:
|
27 |
# Get the current commit hash
|
28 |
-
commit_id =
|
|
|
|
|
|
|
|
|
29 |
# Get the closest tag
|
30 |
-
closest_tag =
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
34 |
# Get the commit count since the closest tag
|
35 |
-
process = subprocess.Popen(
|
|
|
|
|
|
|
36 |
commits_count, _ = process.communicate()
|
37 |
commits_count = int(commits_count.strip())
|
38 |
|
@@ -41,8 +66,4 @@ def get_closest_tag_and_count():
|
|
41 |
else:
|
42 |
return f"{commit_id}({closest_tag}~{commits_count})"
|
43 |
except Exception:
|
44 |
-
return
|
45 |
-
|
46 |
-
|
47 |
-
if RAGFLOW_VERSION_INFO == 'dev':
|
48 |
-
RAGFLOW_VERSION_INFO = get_closest_tag_and_count()
|
|
|
13 |
# See the License for the specific language governing permissions and
|
14 |
# limitations under the License.
|
15 |
#
|
16 |
+
|
17 |
+
import os
|
18 |
import subprocess
|
19 |
|
20 |
+
RAGFLOW_VERSION_INFO = "unknown"
|
|
|
21 |
|
22 |
|
23 |
+
def get_ragflow_version() -> str:
|
24 |
+
global RAGFLOW_VERSION_INFO
|
25 |
+
if RAGFLOW_VERSION_INFO != "unknown":
|
26 |
+
return RAGFLOW_VERSION_INFO
|
27 |
+
version_path = os.path.abspath(
|
28 |
+
os.path.join(
|
29 |
+
os.path.dirname(os.path.realpath(__file__)), os.pardir, "VERSION"
|
30 |
+
)
|
31 |
+
)
|
32 |
+
if os.path.exists(version_path):
|
33 |
+
with open(version_path, "r") as f:
|
34 |
+
RAGFLOW_VERSION_INFO = f.read().strip()
|
35 |
+
else:
|
36 |
+
RAGFLOW_VERSION_INFO = get_closest_tag_and_count()
|
37 |
+
LIGHTEN = int(os.environ.get("LIGHTEN", "0"))
|
38 |
+
RAGFLOW_VERSION_INFO += " slim" if LIGHTEN == 1 else " full"
|
39 |
+
return RAGFLOW_VERSION_INFO
|
40 |
|
41 |
|
42 |
def get_closest_tag_and_count():
|
43 |
try:
|
44 |
# Get the current commit hash
|
45 |
+
commit_id = (
|
46 |
+
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
|
47 |
+
.strip()
|
48 |
+
.decode("utf-8")
|
49 |
+
)
|
50 |
# Get the closest tag
|
51 |
+
closest_tag = (
|
52 |
+
subprocess.check_output(["git", "describe", "--tags", "--abbrev=0"])
|
53 |
+
.strip()
|
54 |
+
.decode("utf-8")
|
55 |
+
)
|
56 |
# Get the commit count since the closest tag
|
57 |
+
process = subprocess.Popen(
|
58 |
+
["git", "rev-list", "--count", f"{closest_tag}..HEAD"],
|
59 |
+
stdout=subprocess.PIPE,
|
60 |
+
)
|
61 |
commits_count, _ = process.communicate()
|
62 |
commits_count = int(commits_count.strip())
|
63 |
|
|
|
66 |
else:
|
67 |
return f"{commit_id}({closest_tag}~{commits_count})"
|
68 |
except Exception:
|
69 |
+
return "unknown"
|
|
|
|
|
|
|
|
build_docker_image.sh
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
|
3 |
-
print_help() {
|
4 |
-
echo "Usage: $0 <option>"
|
5 |
-
echo " full, build full image"
|
6 |
-
echo " slim, build slim image"
|
7 |
-
exit 1
|
8 |
-
}
|
9 |
-
|
10 |
-
if [ "$#" -ne 1 ]; then
|
11 |
-
print_help
|
12 |
-
fi
|
13 |
-
|
14 |
-
docker_version="full"
|
15 |
-
if [ "$1" == "full" ]; then
|
16 |
-
docker_version="full"
|
17 |
-
elif [ "$1" == "slim" ]; then
|
18 |
-
docker_version="slim"
|
19 |
-
else
|
20 |
-
print_help
|
21 |
-
fi
|
22 |
-
|
23 |
-
# update RAGFlow version
|
24 |
-
# Get the latest tag
|
25 |
-
last_tag=$(git describe --tags --abbrev=0)
|
26 |
-
# Get the number of commits from the last tag
|
27 |
-
commit_count=$(git rev-list --count "$last_tag..HEAD")
|
28 |
-
# Get the short commit id
|
29 |
-
last_commit=$(git rev-parse --short HEAD)
|
30 |
-
|
31 |
-
version_info=""
|
32 |
-
if [ "$commit_count" -eq 0 ]; then
|
33 |
-
version_info=$last_tag
|
34 |
-
else
|
35 |
-
printf -v version_info "%s(%s~%d)" "$last_commit" "$last_tag" $commit_count
|
36 |
-
fi
|
37 |
-
# Replace the version in the versions.py file
|
38 |
-
sed -i "s/\"dev\"/\"$version_info\"/" api/versions.py
|
39 |
-
|
40 |
-
if [ "$docker_version" == "full" ]; then
|
41 |
-
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
42 |
-
else
|
43 |
-
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
44 |
-
fi
|
45 |
-
|
46 |
-
git restore api/versions.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/guides/develop/build_docker_image.mdx
CHANGED
@@ -73,8 +73,8 @@ git clone https://github.com/infiniflow/ragflow.git
|
|
73 |
cd ragflow/
|
74 |
pip3 install huggingface-hub nltk
|
75 |
python3 download_deps.py
|
76 |
-
docker build
|
77 |
-
docker build
|
78 |
```
|
79 |
</TabItem>
|
80 |
|
|
|
73 |
cd ragflow/
|
74 |
pip3 install huggingface-hub nltk
|
75 |
python3 download_deps.py
|
76 |
+
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
77 |
+
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
78 |
```
|
79 |
</TabItem>
|
80 |
|
download_deps.py
CHANGED
@@ -7,6 +7,7 @@ import urllib.request
|
|
7 |
|
8 |
urls = [
|
9 |
"http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb",
|
|
|
10 |
"https://repo1.maven.org/maven2/org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar",
|
11 |
"https://repo1.maven.org/maven2/org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar.md5",
|
12 |
"https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken",
|
|
|
7 |
|
8 |
urls = [
|
9 |
"http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb",
|
10 |
+
"http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_arm64.deb",
|
11 |
"https://repo1.maven.org/maven2/org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar",
|
12 |
"https://repo1.maven.org/maven2/org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar.md5",
|
13 |
"https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken",
|