mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 04:59:01 +08:00
Introduced NEED_MIRROR (#3907)
### What problem does this PR solve? Introduced NEED_MIRROR ### Type of change - [x] Refactoring
This commit is contained in:
parent
f54a8d7748
commit
b44321f9c3
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
@ -53,11 +53,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
|
RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
|
||||||
sudo docker pull ubuntu:22.04
|
sudo docker pull ubuntu:22.04
|
||||||
sudo docker build --progress=plain --build-arg LIGHTEN=1 -f Dockerfile -t infiniflow/ragflow:dev-slim .
|
sudo docker build --progress=plain --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:dev-slim .
|
||||||
|
|
||||||
- name: Build ragflow:dev
|
- name: Build ragflow:dev
|
||||||
run: |
|
run: |
|
||||||
sudo docker build --progress=plain -f Dockerfile -t infiniflow/ragflow:dev .
|
sudo docker build --progress=plain --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:dev .
|
||||||
|
|
||||||
- name: Start ragflow:dev-slim
|
- name: Start ragflow:dev-slim
|
||||||
run: |
|
run: |
|
||||||
|
44
Dockerfile
44
Dockerfile
@ -3,6 +3,7 @@ FROM ubuntu:22.04 AS base
|
|||||||
USER root
|
USER root
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
|
ARG NEED_MIRROR=0
|
||||||
ARG LIGHTEN=0
|
ARG LIGHTEN=0
|
||||||
ENV LIGHTEN=${LIGHTEN}
|
ENV LIGHTEN=${LIGHTEN}
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/huggingface.co
|
|||||||
/huggingface.co/InfiniFlow/deepdoc \
|
/huggingface.co/InfiniFlow/deepdoc \
|
||||||
| tar -xf - --strip-components=3 -C /ragflow/rag/res/deepdoc
|
| tar -xf - --strip-components=3 -C /ragflow/rag/res/deepdoc
|
||||||
RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/huggingface.co,target=/huggingface.co \
|
RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/huggingface.co,target=/huggingface.co \
|
||||||
if [ "$LIGHTEN" == "0" ]; then \
|
if [ "$LIGHTEN" != "1" ]; then \
|
||||||
(tar -cf - \
|
(tar -cf - \
|
||||||
/huggingface.co/BAAI/bge-large-zh-v1.5 \
|
/huggingface.co/BAAI/bge-large-zh-v1.5 \
|
||||||
/huggingface.co/BAAI/bge-reranker-v2-m3 \
|
/huggingface.co/BAAI/bge-reranker-v2-m3 \
|
||||||
@ -35,25 +36,27 @@ RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/,target=/deps
|
|||||||
ENV TIKA_SERVER_JAR="file:///ragflow/tika-server-standard-3.0.0.jar"
|
ENV TIKA_SERVER_JAR="file:///ragflow/tika-server-standard-3.0.0.jar"
|
||||||
|
|
||||||
# Setup apt
|
# Setup apt
|
||||||
RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
|
|
||||||
sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list && \
|
|
||||||
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
|
||||||
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \
|
|
||||||
apt update && apt --no-install-recommends install -y ca-certificates && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# cv2 requires libGL.so.1
|
# cv2 requires libGL.so.1
|
||||||
RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
|
RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
|
||||||
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 \
|
if [ "$NEED_MIRROR" == "1" ]; then \
|
||||||
libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget git nginx libgl1 vim less && \
|
sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list; \
|
||||||
rm -rf /var/lib/apt/lists/*
|
fi; \
|
||||||
|
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
||||||
|
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \
|
||||||
|
apt update && \
|
||||||
|
apt --no-install-recommends install -y ca-certificates && \
|
||||||
|
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 \
|
||||||
|
libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget git nginx libgl1 vim less
|
||||||
|
|
||||||
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
|
RUN if [ "$NEED_MIRROR" == "1" ]; then \
|
||||||
pip3 config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
|
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
|
||||||
pipx install poetry && \
|
pip3 config set global.trusted-host pypi.tuna.tsinghua.edu.cn; \
|
||||||
pipx runpip poetry config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
|
fi; \
|
||||||
pipx runpip poetry config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
|
pipx install poetry; \
|
||||||
/root/.local/bin/poetry self add poetry-plugin-pypi-mirror
|
if [ "$NEED_MIRROR" == "1" ]; then \
|
||||||
|
pipx inject poetry poetry-plugin-pypi-mirror; \
|
||||||
|
fi
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
||||||
ENV PATH=/root/.local/bin:$PATH
|
ENV PATH=/root/.local/bin:$PATH
|
||||||
@ -62,7 +65,6 @@ ENV POETRY_NO_INTERACTION=1
|
|||||||
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
ENV POETRY_VIRTUALENVS_CREATE=true
|
ENV POETRY_VIRTUALENVS_CREATE=true
|
||||||
ENV POETRY_REQUESTS_TIMEOUT=15
|
ENV POETRY_REQUESTS_TIMEOUT=15
|
||||||
ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/
|
|
||||||
|
|
||||||
# nodejs 12.22 on Ubuntu 22.04 is too old
|
# nodejs 12.22 on Ubuntu 22.04 is too old
|
||||||
RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
|
RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
|
||||||
@ -70,8 +72,7 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
|
|||||||
apt purge -y nodejs npm && \
|
apt purge -y nodejs npm && \
|
||||||
apt autoremove && \
|
apt autoremove && \
|
||||||
apt update && \
|
apt update && \
|
||||||
apt install -y nodejs cargo && \
|
apt install -y nodejs cargo
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Add dependencies of selenium
|
# Add dependencies of selenium
|
||||||
RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/chrome-linux64-121-0-6167-85,target=/chrome-linux64.zip \
|
RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/chrome-linux64-121-0-6167-85,target=/chrome-linux64.zip \
|
||||||
@ -103,6 +104,9 @@ WORKDIR /ragflow
|
|||||||
COPY pyproject.toml poetry.toml poetry.lock ./
|
COPY pyproject.toml poetry.toml poetry.lock ./
|
||||||
|
|
||||||
RUN --mount=type=cache,id=ragflow_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
RUN --mount=type=cache,id=ragflow_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
||||||
|
if [ "$NEED_MIRROR" == "1" ]; then \
|
||||||
|
export POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/; \
|
||||||
|
fi; \
|
||||||
if [ "$LIGHTEN" == "1" ]; then \
|
if [ "$LIGHTEN" == "1" ]; then \
|
||||||
poetry install --no-root; \
|
poetry install --no-root; \
|
||||||
else \
|
else \
|
||||||
|
@ -289,14 +289,14 @@ docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
|||||||
|
|
||||||
1. Install Poetry, or skip this step if it is already installed:
|
1. Install Poetry, or skip this step if it is already installed:
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://install.python-poetry.org | python3 -
|
pipx install poetry
|
||||||
|
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Clone the source code and install Python dependencies:
|
2. Clone the source code and install Python dependencies:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/infiniflow/ragflow.git
|
git clone https://github.com/infiniflow/ragflow.git
|
||||||
cd ragflow/
|
cd ragflow/
|
||||||
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
|
||||||
~/.local/bin/poetry install --sync --no-root --with=full # install RAGFlow dependent python modules
|
~/.local/bin/poetry install --sync --no-root --with=full # install RAGFlow dependent python modules
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -264,14 +264,14 @@ docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
|||||||
|
|
||||||
1. Instal Poetry, atau lewati langkah ini jika sudah terinstal:
|
1. Instal Poetry, atau lewati langkah ini jika sudah terinstal:
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://install.python-poetry.org | python3 -
|
pipx install poetry
|
||||||
|
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Clone kode sumber dan instal dependensi Python:
|
2. Clone kode sumber dan instal dependensi Python:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/infiniflow/ragflow.git
|
git clone https://github.com/infiniflow/ragflow.git
|
||||||
cd ragflow/
|
cd ragflow/
|
||||||
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
|
||||||
~/.local/bin/poetry install --sync --no-root # install modul python RAGFlow
|
~/.local/bin/poetry install --sync --no-root # install modul python RAGFlow
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -245,14 +245,14 @@ docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
|||||||
|
|
||||||
1. Poetry をインストールする。すでにインストールされている場合は、このステップをスキップしてください:
|
1. Poetry をインストールする。すでにインストールされている場合は、このステップをスキップしてください:
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://install.python-poetry.org | python3 -
|
pipx install poetry
|
||||||
|
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
```
|
```
|
||||||
|
|
||||||
2. ソースコードをクローンし、Python の依存関係をインストールする:
|
2. ソースコードをクローンし、Python の依存関係をインストールする:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/infiniflow/ragflow.git
|
git clone https://github.com/infiniflow/ragflow.git
|
||||||
cd ragflow/
|
cd ragflow/
|
||||||
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
|
||||||
~/.local/bin/poetry install --sync --no-root # install RAGFlow dependent python modules
|
~/.local/bin/poetry install --sync --no-root # install RAGFlow dependent python modules
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -247,14 +247,14 @@ docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
|||||||
|
|
||||||
1. Poetry를 설치하거나 이미 설치된 경우 이 단계를 건너뜁니다:
|
1. Poetry를 설치하거나 이미 설치된 경우 이 단계를 건너뜁니다:
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://install.python-poetry.org | python3 -
|
pipx install poetry
|
||||||
|
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 소스 코드를 클론하고 Python 의존성을 설치합니다:
|
2. 소스 코드를 클론하고 Python 의존성을 설치합니다:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/infiniflow/ragflow.git
|
git clone https://github.com/infiniflow/ragflow.git
|
||||||
cd ragflow/
|
cd ragflow/
|
||||||
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
|
||||||
~/.local/bin/poetry install --sync --no-root # install RAGFlow dependent python modules
|
~/.local/bin/poetry install --sync --no-root # install RAGFlow dependent python modules
|
||||||
```
|
```
|
||||||
|
|
||||||
|
10
README_zh.md
10
README_zh.md
@ -235,7 +235,7 @@ RAGFlow 默认使用 Elasticsearch 存储文本和向量数据. 如果要切换
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/infiniflow/ragflow.git
|
git clone https://github.com/infiniflow/ragflow.git
|
||||||
cd ragflow/
|
cd ragflow/
|
||||||
docker build --build-arg LIGHTEN=1 -f Dockerfile -t infiniflow/ragflow:dev-slim .
|
docker build --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:dev-slim .
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🔧 源码编译 Docker 镜像(包含 embedding 模型)
|
## 🔧 源码编译 Docker 镜像(包含 embedding 模型)
|
||||||
@ -245,21 +245,23 @@ docker build --build-arg LIGHTEN=1 -f Dockerfile -t infiniflow/ragflow:dev-slim
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/infiniflow/ragflow.git
|
git clone https://github.com/infiniflow/ragflow.git
|
||||||
cd ragflow/
|
cd ragflow/
|
||||||
docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
docker build --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:dev .
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🔨 以源代码启动服务
|
## 🔨 以源代码启动服务
|
||||||
|
|
||||||
1. 安装 Poetry。如已经安装,可跳过本步骤:
|
1. 安装 Poetry。如已经安装,可跳过本步骤:
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://install.python-poetry.org | python3 -
|
pipx install poetry
|
||||||
|
pipx inject poetry poetry-plugin-pypi-mirror
|
||||||
|
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
|
export POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 下载源代码并安装 Python 依赖:
|
2. 下载源代码并安装 Python 依赖:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/infiniflow/ragflow.git
|
git clone https://github.com/infiniflow/ragflow.git
|
||||||
cd ragflow/
|
cd ragflow/
|
||||||
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
|
|
||||||
~/.local/bin/poetry install --sync --no-root # install RAGFlow dependent python modules
|
~/.local/bin/poetry install --sync --no-root # install RAGFlow dependent python modules
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ cd ragflow/
|
|||||||
1. Install Poetry:
|
1. Install Poetry:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://install.python-poetry.org | python3 -
|
pipx install poetry
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Configure Poetry:
|
2. Configure Poetry:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user