diff --git a/Dockerfile b/Dockerfile index 0ca489167..682336f58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,13 +15,15 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked # If you download Python modules too slow, you can use a pip mirror site to speed up apt and poetry RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources -ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \ - apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-pip python3-poetry \ - && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \ + apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx \ && rm -rf /var/lib/apt/lists/* +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" \ + && pipx install poetry \ + && /root/.local/bin/poetry self add poetry-plugin-pypi-mirror + # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13 # aspose-slides on linux/arm64 is unavailable RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \ @@ -30,12 +32,13 @@ RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/li fi ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 - +ENV PATH=/root/.local/bin:$PATH # Configure Poetry ENV POETRY_NO_INTERACTION=1 ENV POETRY_VIRTUALENVS_IN_PROJECT=true ENV POETRY_VIRTUALENVS_CREATE=true ENV POETRY_REQUESTS_TIMEOUT=15 +ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/ # builder stage FROM base AS builder @@ -57,9 +60,9 @@ COPY pyproject.toml poetry.toml poetry.lock ./ RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \ if [ "$LIGHTEN" -eq 0 ]; then \ - poetry install --sync --no-root --with=full; \ + poetry install --no-root --with=full; \ else \ - poetry install --sync --no-root; \ + poetry install --no-root; \ fi # production stage diff --git a/Dockerfile.slim b/Dockerfile.slim index 16b6d6c74..e2e35f326 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -15,26 +15,30 @@ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked # If you download Python modules too slow, you can use a pip mirror site to speed up apt and poetry RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources -ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/ RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \ - apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-pip python3-poetry \ - && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \ + apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx \ && rm -rf /var/lib/apt/lists/* +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" \ + && pipx install poetry \ + && /root/.local/bin/poetry self add poetry-plugin-pypi-mirror + # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13 # aspose-slides on linux/arm64 is unavailable -RUN if [ "${ARCH}" = "amd64" ]; then \ - 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; \ +RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \ + if [ "${ARCH}" = "amd64" ]; then \ + dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \ fi ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 - +ENV PATH=/root/.local/bin:$PATH # Configure Poetry ENV POETRY_NO_INTERACTION=1 ENV POETRY_VIRTUALENVS_IN_PROJECT=true ENV POETRY_VIRTUALENVS_CREATE=true ENV POETRY_REQUESTS_TIMEOUT=15 +ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/ # builder stage FROM base AS builder @@ -56,9 +60,9 @@ COPY pyproject.toml poetry.toml poetry.lock ./ RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \ if [ "$LIGHTEN" -eq 0 ]; then \ - poetry install --sync --no-root --with=full; \ + poetry install --no-root --with=full; \ else \ - poetry install --sync --no-root; \ + poetry install --no-root; \ fi # production stage