Change index url per NEED_MIRROR (#4515)

### What problem does this PR solve?

Change index url per NEED_MIRROR. Close #4507

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Zhichang Yu 2025-01-17 12:01:04 +08:00 committed by GitHub
parent c0799c53b3
commit 0efe7a544b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,7 +130,14 @@ WORKDIR /ragflow
# install dependencies from uv.lock file # install dependencies from uv.lock file
COPY pyproject.toml uv.lock ./ COPY pyproject.toml uv.lock ./
# https://github.com/astral-sh/uv/issues/10462
# uv records index url into uv.lock but doesn't failover among multiple indexes
RUN --mount=type=cache,id=ragflow_uv,target=/root/.cache/uv,sharing=locked \ RUN --mount=type=cache,id=ragflow_uv,target=/root/.cache/uv,sharing=locked \
if [ "$NEED_MIRROR" == "1" ]; then \
sed -i 's|pypi.org|pypi.tuna.tsinghua.edu.cn|g' uv.lock; \
else \
sed -i 's|pypi.tuna.tsinghua.edu.cn|pypi.org|g' uv.lock; \
fi; \
if [ "$LIGHTEN" == "1" ]; then \ if [ "$LIGHTEN" == "1" ]; then \
uv sync --python 3.10 --frozen; \ uv sync --python 3.10 --frozen; \
else \ else \