Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Dockerfile.slim 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. COPY docs docs
  38. RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
  39. cd web && npm i && npm run build
  40. # install dependencies from poetry.lock file
  41. COPY pyproject.toml poetry.toml poetry.lock ./
  42. RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
  43. if [ "$LIGHTEN" -eq 0 ]; then \
  44. poetry install --sync --no-root --with=full; \
  45. else \
  46. poetry install --sync --no-root; \
  47. fi
  48. # production stage
  49. FROM base AS production
  50. USER root
  51. WORKDIR /ragflow
  52. # Install python packages' dependencies
  53. # cv2 requires libGL.so.1
  54. RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=locked \
  55. apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
  56. rm -rf /var/lib/apt/lists/*
  57. COPY web web
  58. COPY api api
  59. COPY conf conf
  60. COPY deepdoc deepdoc
  61. COPY rag rag
  62. COPY agent agent
  63. COPY graphrag graphrag
  64. COPY pyproject.toml poetry.toml poetry.lock ./
  65. # Copy models downloaded via download_deps.py
  66. RUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflow
  67. RUN --mount=type=bind,source=huggingface.co,target=/huggingface.co \
  68. tar --exclude='.*' -cf - \
  69. /huggingface.co/InfiniFlow/text_concat_xgb_v1.0 \
  70. /huggingface.co/InfiniFlow/deepdoc \
  71. | tar -xf - --strip-components=3 -C /ragflow/rag/res/deepdoc
  72. # Copy nltk data downloaded via download_deps.py
  73. COPY nltk_data /root/nltk_data
  74. # Copy compiled web pages
  75. COPY --from=builder /ragflow/web/dist /ragflow/web/dist
  76. # Copy Python environment and packages
  77. ENV VIRTUAL_ENV=/ragflow/.venv
  78. COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
  79. ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
  80. ENV PYTHONPATH=/ragflow/
  81. COPY docker/entrypoint.sh ./entrypoint.sh
  82. RUN chmod +x ./entrypoint.sh
  83. ENTRYPOINT ["./entrypoint.sh"]