RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Refactor dockerfile (#3741)
Kevin Hu9a3febb7c522
diff --git a/Dockerfile b/Dockerfileindex 3595720e08..985eb061bb 100644--- a/Dockerfile+++ b/Dockerfile@@ -59,6 +59,21 @@ USER rootWORKDIR /ragflow+# install dependencies from poetry.lock file+COPY pyproject.toml poetry.toml poetry.lock ./++RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \+ if [ "$LIGHTEN" == "1" ]; then \+ poetry install --no-root; \+ else \+ poetry install --no-root --with=full; \+ fi++COPY web web+COPY docs docs+RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \+ cd web && npm install --force && npm run build+COPY .git /ragflow/.gitRUN current_commit=$(git rev-parse --short HEAD); \@@ -78,28 +93,16 @@ RUN current_commit=$(git rev-parse --short HEAD); \echo "RAGFlow version: $version_info"; \echo $version_info > /ragflow/VERSION-COPY web web-COPY docs docs-RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \- cd web && npm install --force && npm run build--# install dependencies from poetry.lock file-COPY pyproject.toml poetry.toml poetry.lock ./--RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \- if [ "$LIGHTEN" == "1" ]; then \- poetry install --no-root; \- else \- poetry install --no-root --with=full; \- fi-# production stageFROM base AS productionUSER rootWORKDIR /ragflow-COPY --from=builder /ragflow/VERSION /ragflow/VERSION+# Copy Python environment and packages+ENV VIRTUAL_ENV=/ragflow/.venv+COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}+ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"# Install python packages' dependencies# cv2 requires libGL.so.1@@ -107,15 +110,6 @@ RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=lapt update && apt install -y --no-install-recommends nginx libgl1 vim less && \rm -rf /var/lib/apt/lists/*-COPY web web-COPY api api-COPY conf conf-COPY deepdoc deepdoc-COPY rag rag-COPY agent agent-COPY graphrag graphrag-COPY pyproject.toml poetry.toml poetry.lock ./-# Copy models downloaded via download_deps.pyRUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflowRUN --mount=type=bind,source=huggingface.co,target=/huggingface.co \@@ -153,18 +147,24 @@ RUN --mount=type=bind,source=chromedriver-linux64-121-0-6167-85,target=/chromedrmv chromedriver /usr/local/bin/ && \rm -f /usr/bin/google-chrome-# Copy compiled web pages-COPY --from=builder /ragflow/web/dist /ragflow/web/dist--# Copy Python environment and packages-ENV VIRTUAL_ENV=/ragflow/.venv-COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}-ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"-ENV PYTHONPATH=/ragflow/+COPY web web+COPY api api+COPY conf conf+COPY deepdoc deepdoc+COPY rag rag+COPY agent agent+COPY graphrag graphrag+COPY pyproject.toml poetry.toml poetry.lock ./+COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.templateCOPY docker/entrypoint.sh ./entrypoint.shRUN chmod +x ./entrypoint.sh+# Copy compiled web pages+COPY --from=builder /ragflow/web/dist /ragflow/web/dist++COPY --from=builder /ragflow/VERSION /ragflow/VERSION+ENTRYPOINT ["./entrypoint.sh"]