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 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # base stage
  2. FROM ubuntu:24.04 AS base
  3. USER root
  4. ENV LIGHTEN=0
  5. WORKDIR /ragflow
  6. RUN rm -f /etc/apt/apt.conf.d/docker-clean \
  7. && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
  8. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  9. apt update && apt-get --no-install-recommends install -y ca-certificates
  10. # if you located in China, you can use tsinghua mirror to speed up apt
  11. RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
  12. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  13. apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 \
  14. && rm -rf /var/lib/apt/lists/* \
  15. && curl -sSL https://install.python-poetry.org | python3 -
  16. ENV PYTHONDONTWRITEBYTECODE=1 LD_LIBRARY_PATH=usr/lib/x86_64-linux-gnu/openmpi/lib:$LD_LIBRARY_PATH
  17. # Configure Poetry
  18. ENV POETRY_NO_INTERACTION=1
  19. ENV POETRY_VIRTUALENVS_IN_PROJECT=true
  20. ENV POETRY_VIRTUALENVS_CREATE=true
  21. ENV POETRY_REQUESTS_TIMEOUT=15
  22. # builder stage
  23. FROM base AS builder
  24. USER root
  25. WORKDIR /ragflow
  26. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  27. apt update && apt install -y nodejs npm cargo && \
  28. rm -rf /var/lib/apt/lists/*
  29. COPY web web
  30. RUN cd web && npm i --force && npm run build
  31. # install dependencies from poetry.lock file
  32. COPY pyproject.toml poetry.toml poetry.lock ./
  33. RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
  34. if [ "$LIGHTEN" -eq 0 ]; then \
  35. /root/.local/bin/poetry install --sync --no-cache --no-root --with=full; \
  36. else \
  37. /root/.local/bin/poetry install --sync --no-cache --no-root; \
  38. fi
  39. # production stage
  40. FROM base AS production
  41. USER root
  42. WORKDIR /ragflow
  43. # Install python packages' dependencies
  44. # cv2 requires libGL.so.1
  45. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  46. apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
  47. rm -rf /var/lib/apt/lists/*
  48. COPY web web
  49. COPY api api
  50. COPY conf conf
  51. COPY deepdoc deepdoc
  52. COPY rag rag
  53. COPY agent agent
  54. COPY graphrag graphrag
  55. COPY pyproject.toml poetry.toml poetry.lock ./
  56. # Copy models downloaded via download_deps.py
  57. RUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflow
  58. RUN --mount=type=bind,source=huggingface.io,target=/huggingface.io \
  59. tar --exclude='.*' -cf - \
  60. /huggingface.io/InfiniFlow/text_concat_xgb_v1.0 \
  61. /huggingface.io/InfiniFlow/deepdoc \
  62. | tar -xf - --strip-components=3 -C /ragflow/rag/res/deepdoc
  63. RUN --mount=type=bind,source=huggingface.io,target=/huggingface.io \
  64. tar -cf - \
  65. /huggingface.io/BAAI/bge-large-zh-v1.5 \
  66. /huggingface.io/BAAI/bge-reranker-v2-m3 \
  67. /huggingface.io/maidalun1020/bce-embedding-base_v1 \
  68. /huggingface.io/maidalun1020/bce-reranker-base_v1 \
  69. | tar -xf - --strip-components=2 -C /root/.ragflow
  70. # Copy compiled web pages
  71. COPY --from=builder /ragflow/web/dist /ragflow/web/dist
  72. # Copy Python environment and packages
  73. ENV VIRTUAL_ENV=/ragflow/.venv
  74. COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
  75. ENV PATH="${VIRTUAL_ENV}/bin:/root/.local/bin:${PATH}"
  76. # Download nltk data
  77. RUN python3 -m nltk.downloader wordnet punkt punkt_tab
  78. ENV PYTHONPATH=/ragflow/
  79. COPY docker/entrypoint.sh ./entrypoint.sh
  80. RUN chmod +x ./entrypoint.sh
  81. ENTRYPOINT ["./entrypoint.sh"]