Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Dockerfile.slim 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # base stage
  2. FROM ubuntu:24.04 AS base
  3. USER root
  4. ARG ARCH=amd64
  5. ENV LIGHTEN=1
  6. WORKDIR /ragflow
  7. RUN rm -f /etc/apt/apt.conf.d/docker-clean \
  8. && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
  9. RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
  10. apt update && apt-get --no-install-recommends install -y ca-certificates
  11. # If you download Python modules too slow, you can use a pip mirror site to speed up apt and poetry
  12. RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
  13. ENV POETRY_PYPI_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple/
  14. RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
  15. apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-pip python3-poetry \
  16. && pip3 install --user --break-system-packages poetry-plugin-pypi-mirror --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \
  17. && rm -rf /var/lib/apt/lists/*
  18. # https://forum.aspose.com/t/aspose-slides-for-net-no-usable-version-of-libssl-found-with-linux-server/271344/13
  19. # aspose-slides on linux/arm64 is unavailable
  20. RUN if [ "${ARCH}" = "amd64" ]; then \
  21. 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; \
  22. fi
  23. ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  24. # Configure Poetry
  25. ENV POETRY_NO_INTERACTION=1
  26. ENV POETRY_VIRTUALENVS_IN_PROJECT=true
  27. ENV POETRY_VIRTUALENVS_CREATE=true
  28. ENV POETRY_REQUESTS_TIMEOUT=15
  29. # builder stage
  30. FROM base AS builder
  31. USER root
  32. WORKDIR /ragflow
  33. RUN --mount=type=cache,id=ragflow_builder_apt,target=/var/cache/apt,sharing=locked \
  34. apt update && apt install -y nodejs npm cargo && \
  35. rm -rf /var/lib/apt/lists/*
  36. COPY web web
  37. RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
  38. cd web && npm i --force && npm run build
  39. # install dependencies from poetry.lock file
  40. COPY pyproject.toml poetry.toml poetry.lock ./
  41. RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
  42. if [ "$LIGHTEN" -eq 0 ]; then \
  43. poetry install --sync --no-root --with=full; \
  44. else \
  45. poetry install --sync --no-root; \
  46. fi
  47. # production stage
  48. FROM base AS production
  49. USER root
  50. WORKDIR /ragflow
  51. # Install python packages' dependencies
  52. # cv2 requires libGL.so.1
  53. RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=locked \
  54. apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
  55. rm -rf /var/lib/apt/lists/*
  56. COPY web web
  57. COPY api api
  58. COPY conf conf
  59. COPY deepdoc deepdoc
  60. COPY rag rag
  61. COPY agent agent
  62. COPY graphrag graphrag
  63. COPY pyproject.toml poetry.toml poetry.lock ./
  64. # Copy models downloaded via download_deps.py
  65. RUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflow
  66. RUN --mount=type=bind,source=huggingface.co,target=/huggingface.co \
  67. tar --exclude='.*' -cf - \
  68. /huggingface.co/InfiniFlow/text_concat_xgb_v1.0 \
  69. /huggingface.co/InfiniFlow/deepdoc \
  70. | tar -xf - --strip-components=3 -C /ragflow/rag/res/deepdoc
  71. # Copy nltk data downloaded via download_deps.py
  72. COPY nltk_data /root/nltk_data
  73. # Copy compiled web pages
  74. COPY --from=builder /ragflow/web/dist /ragflow/web/dist
  75. # Copy Python environment and packages
  76. ENV VIRTUAL_ENV=/ragflow/.venv
  77. COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
  78. ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
  79. ENV PYTHONPATH=/ragflow/
  80. COPY docker/entrypoint.sh ./entrypoint.sh
  81. RUN chmod +x ./entrypoint.sh
  82. ENTRYPOINT ["./entrypoint.sh"]