Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Dockerfile.slim 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # base stage
  2. FROM ubuntu:24.04 AS base
  3. USER root
  4. ENV LIGHTEN=1
  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 compiled web pages
  57. COPY --from=builder /ragflow/web/dist /ragflow/web/dist
  58. # Copy Python environment and packages
  59. ENV VIRTUAL_ENV=/ragflow/.venv
  60. COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
  61. ENV PATH="${VIRTUAL_ENV}/bin:/root/.local/bin:${PATH}"
  62. # Download nltk data
  63. RUN python3 -m nltk.downloader wordnet punkt punkt_tab
  64. ENV PYTHONPATH=/ragflow/
  65. COPY docker/entrypoint.sh ./entrypoint.sh
  66. RUN chmod +x ./entrypoint.sh
  67. ENTRYPOINT ["./entrypoint.sh"]