Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Dockerfile.scratch 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # base stage
  2. FROM ubuntu:24.04 AS base
  3. USER root
  4. WORKDIR /ragflow
  5. RUN rm -f /etc/apt/apt.conf.d/docker-clean \
  6. && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
  7. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  8. apt update && apt-get --no-install-recommends install -y ca-certificates
  9. # if you located in China, you can use tsinghua mirror to speed up apt
  10. RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
  11. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  12. apt update && apt install -y curl libpython3-dev nginx openmpi-bin openmpi-common libopenmpi-dev libglib2.0-0 libglx-mesa0 \
  13. && rm -rf /var/lib/apt/lists/* \
  14. && curl -sSL https://install.python-poetry.org | python3 -
  15. ENV PYTHONDONTWRITEBYTECODE=1 LD_LIBRARY_PATH=usr/lib/x86_64-linux-gnu/openmpi/lib:$LD_LIBRARY_PATH
  16. # Configure Poetry
  17. ENV POETRY_NO_INTERACTION=1
  18. ENV POETRY_VIRTUALENVS_IN_PROJECT=true
  19. ENV POETRY_VIRTUALENVS_CREATE=true
  20. ENV POETRY_REQUESTS_TIMEOUT=15
  21. # builder stage
  22. FROM base AS builder
  23. USER root
  24. WORKDIR /ragflow
  25. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  26. apt update && apt install -y nodejs npm && \
  27. rm -rf /var/lib/apt/lists/*
  28. # if you located in China, you can use taobao registry to speed up npm and yarn
  29. RUN npm config set registry https://registry.npmmirror.com/
  30. # https://yarnpkg.com/getting-started/install
  31. COPY web web
  32. RUN cd web && npm install -g corepack && corepack enable && yarn install && yarn run build
  33. # install dependencies from poetry.lock file
  34. COPY pyproject.toml poetry.toml poetry.lock ./
  35. RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
  36. /root/.local/bin/poetry install --sync --no-cache --no-root
  37. # production stage
  38. FROM base AS production
  39. USER root
  40. WORKDIR /ragflow
  41. # Install python packages' dependencies
  42. # cv2 requires libGL.so.1
  43. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  44. apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
  45. rm -rf /var/lib/apt/lists/*
  46. COPY web web
  47. COPY api api
  48. COPY conf conf
  49. COPY deepdoc deepdoc
  50. COPY rag rag
  51. COPY agent agent
  52. COPY graphrag graphrag
  53. COPY pyproject.toml poetry.toml poetry.lock ./
  54. # Copy compiled web pages
  55. COPY --from=builder /ragflow/web/dist /ragflow/web/dist
  56. # Copy Python environment and packages
  57. ENV VIRTUAL_ENV=/ragflow/.venv
  58. COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
  59. ENV PATH="${VIRTUAL_ENV}/bin:/root/.local/bin:${PATH}"
  60. # Download nltk data
  61. RUN python3 -m nltk.downloader wordnet punkt punkt_tab
  62. # Copy models downloaded via download_deps.sh
  63. COPY det.onnx layout.laws.onnx layout.manual.onnx layout.onnx layout.paper.onnx ocr.res rec.onnx tsr.onnx updown_concat_xgb.model /ragflow/rag/res/deepdoc/
  64. ENV PYTHONPATH=/ragflow/
  65. COPY docker/entrypoint.sh ./entrypoint.sh
  66. RUN chmod +x ./entrypoint.sh
  67. ENTRYPOINT ["./entrypoint.sh"]