2025-11-04 17:26:44 +08:00
|
|
|
# Use base image built from Dockerfile.base
|
|
|
|
|
# Build base image first: docker build -f Dockerfile.base -t ragflow-base:latest .
|
|
|
|
|
ARG BASE_IMAGE=ragflow-base:latest
|
|
|
|
|
FROM ${BASE_IMAGE} AS base
|
2025-11-04 16:06:36 +08:00
|
|
|
|
|
|
|
|
ARG NEED_MIRROR=0
|
|
|
|
|
ARG LIGHTEN=0
|
|
|
|
|
ENV LIGHTEN=${LIGHTEN}
|
2025-10-13 13:18:03 +08:00
|
|
|
|
2025-11-04 16:06:36 +08:00
|
|
|
# builder stage
|
|
|
|
|
FROM base AS builder
|
|
|
|
|
USER root
|
|
|
|
|
|
|
|
|
|
WORKDIR /ragflow
|
|
|
|
|
|
2025-11-10 17:14:15 +08:00
|
|
|
# Python dependencies are already installed in base image
|
|
|
|
|
# Build web application
|
2025-11-04 16:06:36 +08:00
|
|
|
COPY web web
|
|
|
|
|
COPY docs docs
|
|
|
|
|
RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked \
|
|
|
|
|
cd web && npm install && npm run build
|
|
|
|
|
|
|
|
|
|
COPY .git /ragflow/.git
|
|
|
|
|
|
|
|
|
|
RUN version_info=$(git describe --tags --match=v* --first-parent --always); \
|
|
|
|
|
if [ "$LIGHTEN" == "1" ]; then \
|
|
|
|
|
version_info="$version_info slim"; \
|
|
|
|
|
else \
|
|
|
|
|
version_info="$version_info full"; \
|
|
|
|
|
fi; \
|
|
|
|
|
echo "RAGFlow version: $version_info"; \
|
|
|
|
|
echo $version_info > /ragflow/VERSION
|
|
|
|
|
|
|
|
|
|
# production stage
|
|
|
|
|
FROM base AS production
|
|
|
|
|
USER root
|
|
|
|
|
|
|
|
|
|
WORKDIR /ragflow
|
|
|
|
|
|
2025-11-10 17:14:15 +08:00
|
|
|
# Python environment is already set up in base image
|
2025-11-04 16:06:36 +08:00
|
|
|
ENV PYTHONPATH=/ragflow/
|
|
|
|
|
|
|
|
|
|
COPY web web
|
|
|
|
|
COPY admin admin
|
2025-10-13 13:18:03 +08:00
|
|
|
COPY api api
|
|
|
|
|
COPY conf conf
|
|
|
|
|
COPY deepdoc deepdoc
|
|
|
|
|
COPY rag rag
|
|
|
|
|
COPY agent agent
|
|
|
|
|
COPY graphrag graphrag
|
|
|
|
|
COPY agentic_reasoning agentic_reasoning
|
2025-11-06 17:15:46 +08:00
|
|
|
COPY pyproject.toml ./
|
2025-10-13 13:18:03 +08:00
|
|
|
COPY mcp mcp
|
|
|
|
|
COPY plugin plugin
|
|
|
|
|
|
|
|
|
|
COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
|
2025-11-06 17:15:46 +08:00
|
|
|
COPY --chmod=+x docker/entrypoint.sh ./entrypoint.sh
|
|
|
|
|
|
2025-10-13 13:18:03 +08:00
|
|
|
|
2025-11-04 16:06:36 +08:00
|
|
|
# Copy compiled web pages
|
|
|
|
|
COPY --from=builder /ragflow/web/dist /ragflow/web/dist
|
|
|
|
|
|
|
|
|
|
COPY --from=builder /ragflow/VERSION /ragflow/VERSION
|
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|