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
CI: add Dockerfile_go build and api test (#19232)
maoyifeng0cee507c3edb
diff --git a/.github/workflows/sep-tests.yml b/.github/workflows/sep-tests.ymlindex 28b16885bf..996ce0ce67 100644--- a/.github/workflows/sep-tests.yml+++ b/.github/workflows/sep-tests.yml@@ -433,17 +433,24 @@ jobs:RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-${HOME}}BUILD_LOCK_FILE=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/docker-build.lockmkdir -p "$(dirname "${BUILD_LOCK_FILE}")"- # Pass the Gitee personal access token to the Docker build as a BuildKit secret- # (mounted inside the builder at /run/secrets/gitee_token, never persisted in any layer).- GITEE_TOKEN_FILE="$(mktemp)"- printf '%s' '${GITEE_TOKEN}' > "${GITEE_TOKEN_FILE}"+ # Pass the Gitee personal access token to the Docker build via --build-arg GITEE_TOKEN.+ # Dockerfile_go / Dockerfile_ci read it from ARG GITEE_TOKEN (NOT a BuildKit secret),+ # so the runner must expose GITEE_TOKEN as an environment variable (e.g. via the+ # runner's docker-compose `environment:` mapping sourced from its .env file).+ # Pick the Dockerfile matching the API proxy scheme:+ # - go -> Dockerfile_go (Go-native image)+ # - * -> Dockerfile_ci (Python/legacy image)+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ DOCKERFILE=Dockerfile_go+ else+ DOCKERFILE=Dockerfile_ci+ fi(flock -w 10800 9 || { echo "Timed out waiting for the shared Docker build slot" >&2; exit 1; }- echo "Acquired Docker build slot for ${DOC_ENGINE}/${API_PROXY_SCHEME}"+ echo "Acquired Docker build slot for ${DOC_ENGINE}/${API_PROXY_SCHEME} (dockerfile=${DOCKERFILE})"##sudo docker pull ubuntu:24.04- sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --secret id=gitee_token,src=${GITEE_TOKEN_FILE} -f Dockerfile_ci -t ${RAGFLOW_IMAGE} .+ sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg GITEE_TOKEN=${GITEE_TOKEN} -f "${DOCKERFILE}" -t ${RAGFLOW_IMAGE} .) 9>"${BUILD_LOCK_FILE}"- rm -f "${GITEE_TOKEN_FILE}"- name: Prepare Python test environmentif: env.API_PROXY_SCHEME != 'web'@@ -481,7 +488,7 @@ jobs:# Engine-specific offset partitions keep concurrent engine jobs from# choosing the same host ports when they land on the same self-hosted runner.# A lock plus reservation file closes the check/start race between parallel jobs.- PORT_BASES=(1200 1201 23817 23820 5432 5455 9000 9001 6379 6380 6601 9380 9381 9382 9384 9383 9385 80 443 4222 8222)+ PORT_BASES=(1200 1201 23817 23820 5432 5455 9000 9001 6379 6380 6601 9380 9381 9382 9384 9383 9385 80 443 4222 8222 9900 8123)PARTITION_SIZE=6000case "${DOC_ENGINE}" inelasticsearch) PARTITION_BASE=1000 ;;@@ -641,10 +648,20 @@ jobs:SANDBOX_EXECUTOR_MANAGER_PORT=$((9385 + PORT_OFFSET))SVR_WEB_HTTP_PORT=$((80 + PORT_OFFSET))SVR_WEB_HTTPS_PORT=$((443 + PORT_OFFSET))+ EXPOSE_CLICKHOUSE_TCP_PORT=$((9900 + PORT_OFFSET))+ CLICKHOUSE_HTTP_PORT=$((8123 + PORT_OFFSET))# Persist computed ports into .env so docker-compose uses the correct host bindings.# Remove previous CI overrides first; docker compose uses the last duplicate key.- sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^GO_HTTP_PORT=/d;/^GO_ADMIN_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d;/^API_PROXY_SCHEME=/d' .env+ sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^GO_HTTP_PORT=/d;/^GO_ADMIN_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d;/^API_PROXY_SCHEME=/d' .env+ # docker-compose-go.yml uses env_file: .env-go for the ragflow-cpu+ # container, so the Go server process reads COMPOSE_PROFILES and+ # TEI_MODEL from .env-go (not .env). Without syncing these two,+ # the Go server's checkModelAvailable TEI bypass never triggers+ # because .env-go's COMPOSE_PROFILES lacks "tei-", causing+ # PATCH /models/default to fail for the Builtin/Local embedding+ # model and datasets to be created with an empty embedding_model.+ sed -i '/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d' .env-go{echo ""echo "ES_PORT=${ES_PORT}"@@ -668,12 +685,32 @@ jobs:echo "SANDBOX_EXECUTOR_MANAGER_PORT=${SANDBOX_EXECUTOR_MANAGER_PORT}"echo "SVR_WEB_HTTP_PORT=${SVR_WEB_HTTP_PORT}"echo "SVR_WEB_HTTPS_PORT=${SVR_WEB_HTTPS_PORT}"- echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql"+ echo "EXPOSE_CLICKHOUSE_TCP_PORT=${EXPOSE_CLICKHOUSE_TCP_PORT}"+ echo "CLICKHOUSE_HTTP_PORT=${CLICKHOUSE_HTTP_PORT}"+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql,clickhouse"+ else+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql"+ fiecho "TEI_MODEL=BAAI/bge-small-en-v1.5"echo "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}"echo "DOC_ENGINE=${DOC_ENGINE}"echo "API_PROXY_SCHEME=${API_PROXY_SCHEME}"} >> .env+ # Sync COMPOSE_PROFILES and TEI_MODEL into .env-go so the Go+ # server container (env_file: .env-go) sees the same TEI bypass+ # config as the Python container. Only these two affect the+ # in-process checkModelAvailable logic; other .env keys are+ # either yml-interpolation-only or already correct in .env-go.+ {+ echo ""+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql,clickhouse"+ else+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql"+ fi+ echo "TEI_MODEL=BAAI/bge-small-en-v1.5"+ } >> .env-goif [[ "${API_PROXY_SCHEME}" == "go" ]]; thenRAGFLOW_HTTP_PORT=${SVR_WEB_HTTP_PORT}else@@ -693,9 +730,14 @@ jobs:- name: Start ragflow:nightly for Infinityrun: |- sudo docker compose -f docker/docker-compose.yml -p ${COMPOSE_PROJECT_NAME} down -v || true+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ COMPOSE_FILE=docker/docker-compose-go.yml+ else+ COMPOSE_FILE=docker/docker-compose.yml+ fi+ sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} down -v || truesudo docker ps -a --filter "label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}" -q | xargs -r sudo docker rm -f- sudo docker compose -f docker/docker-compose.yml -p ${COMPOSE_PROJECT_NAME} up -d+ sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} up -d- name: Run sdk tests against Infinityif: env.API_PROXY_SCHEME == 'python'@@ -906,8 +948,13 @@ jobs:- name: Stop ragflow:nightly for Infinityif: ${{ always() }}run: |+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ COMPOSE_FILE=docker/docker-compose-go.yml+ else+ COMPOSE_FILE=docker/docker-compose.yml+ fi# Sometimes `docker compose down` fail due to hang container, heavy load etc. Need to remove such containers to release resources(for example, listen ports).- sudo docker compose -f docker/docker-compose.yml -p ${COMPOSE_PROJECT_NAME} down -v || true+ sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} down -v || truesudo docker ps -a --filter "label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}" -q | xargs -r sudo docker rm -fif [[ -n ${RAGFLOW_IMAGE} ]]; thensudo docker rmi -f ${RAGFLOW_IMAGE}@@ -1064,17 +1111,24 @@ jobs:RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-${HOME}}BUILD_LOCK_FILE=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/docker-build.lockmkdir -p "$(dirname "${BUILD_LOCK_FILE}")"- # Pass the Gitee personal access token to the Docker build as a BuildKit secret- # (mounted inside the builder at /run/secrets/gitee_token, never persisted in any layer).- GITEE_TOKEN_FILE="$(mktemp)"- printf '%s' '${GITEE_TOKEN }' > "${GITEE_TOKEN_FILE}"+ # Pass the Gitee personal access token to the Docker build via --build-arg GITEE_TOKEN.+ # Dockerfile_go / Dockerfile_ci read it from ARG GITEE_TOKEN (NOT a BuildKit secret),+ # so the runner must expose GITEE_TOKEN as an environment variable (e.g. via the+ # runner's docker-compose `environment:` mapping sourced from its .env file).+ # Pick the Dockerfile matching the API proxy scheme:+ # - go -> Dockerfile_go (Go-native image)+ # - * -> Dockerfile_ci (Python/legacy image)+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ DOCKERFILE=Dockerfile_go+ else+ DOCKERFILE=Dockerfile_ci+ fi(flock -w 10800 9 || { echo "Timed out waiting for the shared Docker build slot" >&2; exit 1; }- echo "Acquired Docker build slot for ${DOC_ENGINE}/${API_PROXY_SCHEME}"+ echo "Acquired Docker build slot for ${DOC_ENGINE}/${API_PROXY_SCHEME} (dockerfile=${DOCKERFILE})"##sudo docker pull ubuntu:24.04- sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --secret id=gitee_token,src=${GITEE_TOKEN_FILE} -f Dockerfile_ci -t ${RAGFLOW_IMAGE} .+ sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg GITEE_TOKEN=${GITEE_TOKEN} -f "${DOCKERFILE}" -t ${RAGFLOW_IMAGE} .) 9>"${BUILD_LOCK_FILE}"- rm -f "${GITEE_TOKEN_FILE}"- name: Prepare Python test environmentif: env.API_PROXY_SCHEME != 'web'@@ -1112,7 +1166,7 @@ jobs:# Engine-specific offset partitions keep concurrent engine jobs from# choosing the same host ports when they land on the same self-hosted runner.# A lock plus reservation file closes the check/start race between parallel jobs.- PORT_BASES=(1200 1201 23817 23820 5432 5455 9000 9001 6379 6380 6601 9380 9381 9382 9384 9383 9385 80 443 4222 8222)+ PORT_BASES=(1200 1201 23817 23820 5432 5455 9000 9001 6379 6380 6601 9380 9381 9382 9384 9383 9385 80 443 4222 8222 9900 8123)PARTITION_SIZE=6000case "${DOC_ENGINE}" inelasticsearch) PARTITION_BASE=1000 ;;@@ -1272,10 +1326,20 @@ jobs:SANDBOX_EXECUTOR_MANAGER_PORT=$((9385 + PORT_OFFSET))SVR_WEB_HTTP_PORT=$((80 + PORT_OFFSET))SVR_WEB_HTTPS_PORT=$((443 + PORT_OFFSET))+ EXPOSE_CLICKHOUSE_TCP_PORT=$((9900 + PORT_OFFSET))+ CLICKHOUSE_HTTP_PORT=$((8123 + PORT_OFFSET))# Persist computed ports into .env so docker-compose uses the correct host bindings.# Remove previous CI overrides first; docker compose uses the last duplicate key.- sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^GO_HTTP_PORT=/d;/^GO_ADMIN_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d;/^API_PROXY_SCHEME=/d' .env+ sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^GO_HTTP_PORT=/d;/^GO_ADMIN_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d;/^API_PROXY_SCHEME=/d' .env+ # docker-compose-go.yml uses env_file: .env-go for the ragflow-cpu+ # container, so the Go server process reads COMPOSE_PROFILES and+ # TEI_MODEL from .env-go (not .env). Without syncing these two,+ # the Go server's checkModelAvailable TEI bypass never triggers+ # because .env-go's COMPOSE_PROFILES lacks "tei-", causing+ # PATCH /models/default to fail for the Builtin/Local embedding+ # model and datasets to be created with an empty embedding_model.+ sed -i '/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d' .env-go{echo ""echo "ES_PORT=${ES_PORT}"@@ -1299,12 +1363,32 @@ jobs:echo "SANDBOX_EXECUTOR_MANAGER_PORT=${SANDBOX_EXECUTOR_MANAGER_PORT}"echo "SVR_WEB_HTTP_PORT=${SVR_WEB_HTTP_PORT}"echo "SVR_WEB_HTTPS_PORT=${SVR_WEB_HTTPS_PORT}"- echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql"+ echo "EXPOSE_CLICKHOUSE_TCP_PORT=${EXPOSE_CLICKHOUSE_TCP_PORT}"+ echo "CLICKHOUSE_HTTP_PORT=${CLICKHOUSE_HTTP_PORT}"+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql,clickhouse"+ else+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql"+ fiecho "TEI_MODEL=BAAI/bge-small-en-v1.5"echo "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}"echo "DOC_ENGINE=${DOC_ENGINE}"echo "API_PROXY_SCHEME=${API_PROXY_SCHEME}"} >> .env+ # Sync COMPOSE_PROFILES and TEI_MODEL into .env-go so the Go+ # server container (env_file: .env-go) sees the same TEI bypass+ # config as the Python container. Only these two affect the+ # in-process checkModelAvailable logic; other .env keys are+ # either yml-interpolation-only or already correct in .env-go.+ {+ echo ""+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql,clickhouse"+ else+ echo "COMPOSE_PROFILES=${DOC_ENGINE},cpu,ragflow-go,tei-cpu,deepdoc,metadata-mysql"+ fi+ echo "TEI_MODEL=BAAI/bge-small-en-v1.5"+ } >> .env-goif [[ "${API_PROXY_SCHEME}" == "go" ]]; thenRAGFLOW_HTTP_PORT=${SVR_WEB_HTTP_PORT}else@@ -1324,9 +1408,14 @@ jobs:- name: Start ragflow:nightly for Elasticsearchrun: |- sudo docker compose -f docker/docker-compose.yml -p ${COMPOSE_PROJECT_NAME} down -v || true+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ COMPOSE_FILE=docker/docker-compose-go.yml+ else+ COMPOSE_FILE=docker/docker-compose.yml+ fi+ sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} down -v || truesudo docker ps -a --filter "label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}" -q | xargs -r sudo docker rm -f- sudo docker compose -f docker/docker-compose.yml -p ${COMPOSE_PROJECT_NAME} up -d+ sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} up -d- name: Run sdk tests against Elasticsearchif: env.API_PROXY_SCHEME == 'python'@@ -1532,8 +1621,13 @@ jobs:- name: Stop ragflow:nightly for Elasticsearchif: ${{ always() }}run: |+ if [ "${API_PROXY_SCHEME}" = "go" ]; then+ COMPOSE_FILE=docker/docker-compose-go.yml+ else+ COMPOSE_FILE=docker/docker-compose.yml+ fi# Sometimes `docker compose down` fail due to hang container, heavy load etc. Need to remove such containers to release resources(for example, listen ports).- sudo docker compose -f docker/docker-compose.yml -p ${COMPOSE_PROJECT_NAME} down -v || true+ sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} down -v || truesudo docker ps -a --filter "label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}" -q | xargs -r sudo docker rm -fif [[ -n ${RAGFLOW_IMAGE} ]]; thensudo docker rmi -f ${RAGFLOW_IMAGE}diff --git a/Dockerfile_go b/Dockerfile_goindex 9560064ded..2d884dc6f0 100644--- a/Dockerfile_go+++ b/Dockerfile_go@@ -8,7 +8,7 @@ ARG NEED_MIRROR=1#Optional parameter#If set NEED_MIRROR=1, and set GITEE_TOKEN="xxxxx" , donwload source from gitee.#If don't set GITEE_TOKEN , download from github-#ARG GITEE_TOKEN=""+ARG GITEE_TOKENWORKDIR /ragflow@@ -59,9 +59,9 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \#libglib2.0-0 libglx-mesa0 libgl1 pkg-config libgdiplus default-jdk libatk-bridge2.0-0 \#libgtk-4-1 libnss3 xdg-utils libjemalloc-dev gnupg unzip curl wget git vim less \#ghostscript pandoc texlive texlive-latex-extra texlive-xetex texlive-lang-chinese \- #fonts-freefont-ttf fonts-noto-cjk postgresql-client+ #fonts-freefont-ttf fonts-noto-cjk postgresql-client libjemalloc2- apt --no-install-recommends install -y ca-certificates libjemalloc2 curl vim unzip iproute2 && \+ apt --no-install-recommends install -y ca-certificates curl vim unzip iproute2 && \rm -rf /var/lib/apt/lists/*# Download resource from GitHub to /usr/share/infinity@@ -112,25 +112,6 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \# exclusively in the `web-builder` stage and never reaches the final image.--# ── cpp-builder stage ──────────────────────────────────────────────-# Compile C++ static library (librag_tokenizer_c_api.a) using the-# infinity_builder image which ships clang-20, cmake and other C++-# tooling. This stage is independent from the base image so that the-# heavy C++ build toolchain does not bloat the final production image.-FROM infiniflow/infinity_builder:ubuntu22_clang20 AS cpp-builder-USER root-SHELL ["/bin/bash", "-c"]--ARG NEED_MIRROR=1-WORKDIR /ragflow--COPY internal/binding/cpp internal/binding/cpp-COPY build.sh ./--RUN git config --global safe.directory "*" && \- cd /ragflow && ./build.sh --cpp-# ── go-builder stage ──FROM infiniflow/github_action_runner:latest AS go-builderUSER root@@ -142,13 +123,48 @@ COPY cmd cmdCOPY go.mod go.sum ./COPY build.sh ./+# Download and extract ONNX Runtime static archives into the user-cache path+# that build.sh expects (ONNXRUNTIME_STATIC_PREFIX =+# ~/ragflow-native-libs/onnxruntime/static_lib).+#+# The github_action_runner base image does NOT ship native libs at+# /opt/ragflow-native-libs, so build.sh's _seed_from_system finds nothing+# and silently skips ORT linking — the resulting binary then fails at+# startup with "no in-process DeepDoc backend serving" because+# dlopen(NULL)/dlsym can't find OrtGetApiBase.+#+# We download ONLY the ORT static zip (not the full download_deps.py, which+# also pulls chrome/tika/nltk/huggingface models that the Go build doesn't+# need). These .a files are consumed at link time only; they do NOT enter+# the final production image (only COPY --from=go-builder /ragflow/bin does).+#+# Seed the ONNX Runtime static archives from the runner image's system+# pre-bake into the user-cache path that build.sh expects+# (ONNXRUNTIME_STATIC_PREFIX = ~/ragflow-native-libs/onnxruntime/static_lib).+# Without this, build.sh's _seed_from_system finds the archives only under+# /opt and silently skips ORT linking — the resulting binary then fails at+# startup with "no in-process DeepDoc backend serving" because+# dlopen(NULL)/dlsym can't find OrtGetApiBase.+# Use ${HOME} (not a hard-coded /root) so the cache path matches+# build.sh's ONNXRUNTIME_STATIC_PREFIX regardless of the image's HOME.+# These .a files are consumed at link time only; they do NOT enter the+# final production image (only COPY --from=go-builder /ragflow/bin does).+ARG ORT_VERSION=1.23.2+RUN set -eux; \+ mkdir -p "${HOME}/ragflow-native-libs/onnxruntime"; \+ cp -rn /opt/ragflow-native-libs/onnxruntime/* "${HOME}/ragflow-native-libs/onnxruntime/"; \+ find "${HOME}/ragflow-native-libs/onnxruntime/static_lib" -name '*.a' | head -5+# Overwrite C++ build artifact from cpp-builder-COPY --from=cpp-builder \- /ragflow/internal/binding/cpp/cmake-build-release/librag_tokenizer_c_api.a \- /ragflow/internal/binding/cpp/cmake-build-release/librag_tokenizer_c_api.a+#COPY --from=cpp-builder \+# /ragflow/internal/binding/cpp/cmake-build-release/librag_tokenizer_c_api.a \+# /ragflow/internal/binding/cpp/cmake-build-release/librag_tokenizer_c_api.a++RUN git config --global safe.directory "*" && \+ cd /ragflow && ./build.sh --cppRUN git config --global safe.directory "*" && \- ./build.sh -s --go+ ./build.sh --go# ── web-builder stage ──@@ -196,7 +212,7 @@ USER rootWORKDIR /ragflow# Copy the compiled Go backend binaries (set exec bits at copy time to avoid a redundant chmod layer)-COPY --from=go-builder --chmod=755 /ragflow/bin/ /ragflow/bin/+COPY --from=go-builder --chmod=755 /ragflow/bin/ragflow_server /ragflow/bin/ragflow_serverENV PYTHONPATH=/ragflow/@@ -209,8 +225,6 @@ RUN mkdir -p /etc/nginx/conf.d /var/log/nginxCOPY docker/nginx/nginx.conf docker/nginx/proxy.conf /etc/nginx/COPY docker/nginx/ragflow.conf.golang \-# docker/nginx/ragflow.conf.python \- docker/nginx/ragflow.conf.hybrid \/etc/nginx/conf.d/RUN rm -f /etc/nginx/sites-enabled/default@@ -218,6 +232,7 @@ RUN rm -f /etc/nginx/sites-enabled/defaultCOPY conf confCOPY agent/templates agent/templates+COPY rag/prompts rag/prompts# Wiki page-structure presets read at runtime by the Go backend# (CompilationTemplateService.LoadWikiPresets).diff --git a/docker/.env b/docker/.envindex 02dc08e93c..4813af9cc9 100644--- a/docker/.env+++ b/docker/.env@@ -203,7 +203,7 @@ CLICKHOUSE_HOST=clickhouse# Native TCP port used by RAGFlow's Go services to connect to ClickHouse inside# the container network. Do NOT change this unless you also change `clickhouse.port`# in conf/service_conf.yaml.template.-CLICKHOUSE_TCP_PORT=9900+CLICKHOUSE_TCP_PORT=9000# Host-side port that maps to the ClickHouse container native TCP port 9000. Change# this to avoid clashing with a port already used on the host machine. This ONLY# affects the published host port and is never read by RAGFlow's internal services.diff --git a/docker/.env-go b/docker/.env-goindex a498d02b54..606e6ad11d 100644--- a/docker/.env-go+++ b/docker/.env-go@@ -35,7 +35,7 @@ DEVICE=${DEVICE:-cpu}# start the in-cluster MySQL service. For external GaussDB, set both# DB_TYPE=gaussdb and METADATA_DB_PROFILE=gaussdb so MySQL stays disabled.METADATA_DB_PROFILE=${METADATA_DB_PROFILE:-mysql}-COMPOSE_PROFILES=${DOC_ENGINE},${DEVICE},metadata-${METADATA_DB_PROFILE}+COMPOSE_PROFILES=${DOC_ENGINE},${DEVICE},metadata-${METADATA_DB_PROFILE},ragflow-go,clickhouse# The version of Elasticsearch.STACK_VERSION=${STACK_VERSION:-8.11.3}diff --git a/docker/entrypoint-go.sh b/docker/entrypoint-go.shindex 2c3fd8a640..7cb9c02ae5 100755--- a/docker/entrypoint-go.sh+++ b/docker/entrypoint-go.sh@@ -288,10 +288,18 @@ if [[ "${INIT_MODEL_PROVIDER_TABLES}" -eq 1 ]]; then# a GaussDB metadata database.echo "Skipping MySQL-specific model provider table migrations for DB_TYPE=${DB_TYPE:-mysql}."else- tools/scripts/run_migrations.sh+ #tools/scripts/run_migrations.sh+ echo ""fifi+if [[ "${ENABLE_DATASYNC}" -eq 1 ]]; then+ echo "Starting data sync..."+ run_with_restart "RAGFlow go server" bin/ragflow_server --syncer --migrate &+fi++sleep 5+if [[ "${ENABLE_ADMIN_SERVER}" -eq 1 ]]; thenif [[ "${API_PROXY_SCHEME}" == "hybrid" ]] || [[ "${API_PROXY_SCHEME}" == "python" ]]; then@@ -301,7 +309,7 @@ if [[ "${ENABLE_ADMIN_SERVER}" -eq 1 ]]; thenif [[ "${API_PROXY_SCHEME}" == "hybrid" ]] || [[ "${API_PROXY_SCHEME}" == "go" ]]; thenecho "Starting Admin go server..."- run_with_restart "Admin go server" bin/ragflow_server --admin &+ run_with_restart "Admin go server" bin/ragflow_server --admin --migrate &fifi@@ -316,14 +324,11 @@ if [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; thenif [[ "${API_PROXY_SCHEME}" == "hybrid" ]] || [[ "${API_PROXY_SCHEME}" == "go" ]]; thenecho "Starting RAGFlow go server..."- run_with_restart "RAGFlow go server" bin/ragflow_server --api &+ run_with_restart "RAGFlow go server" bin/ragflow_server --api --migrate &fifi-if [[ "${ENABLE_DATASYNC}" -eq 1 ]]; then- echo "Starting data sync..."- run_with_restart "RAGFlow go server" bin/ragflow_server --syncer &-fi+#if [[ "${ENABLE_MCP_SERVER}" -eq 1 ]]; then# start_mcp_serverdiff --git a/docker/nginx/ragflow.conf.golang b/docker/nginx/ragflow.conf.golangindex af6607a303..685a8fd6ef 100644--- a/docker/nginx/ragflow.conf.golang+++ b/docker/nginx/ragflow.conf.golang@@ -25,6 +25,27 @@ server {include proxy.conf;}+ location ~ ^/api/v1/datasets/search {+ proxy_pass http://127.0.0.1:9384;+ include proxy.conf;+ }++ location ~ ^/api/v1/chat/completions {+ proxy_pass http://127.0.0.1:9384;+ include proxy.conf;+ }++ location ~ ^/v1/system/config {+ proxy_pass http://127.0.0.1:9384;+ include proxy.conf;+ }++ location ~ ^/v1/user/(login|logout) {+ proxy_pass http://127.0.0.1:9384;+ include proxy.conf;+ }++location / {index index.html;try_files $uri $uri/ /index.html;