Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

add dockerfile for openshift platform

meizi69e27d00c4344
diff --git a/docker/Dockerfile.claw b/docker/Dockerfile.claw
index 59c338e857..7c7cd1de05 100644
--- a/docker/Dockerfile.claw
+++ b/docker/Dockerfile.claw
@@ -16,7 +16,7 @@ RUN groupadd --gid 1000 app \
WORKDIR /app/jiuwenswarm
COPY --chown=app:app . /app/jiuwenswarm/
-RUN sed -i '/openjiuwen_runtime_foundation/d' pyproject.toml
+RUN sed -i '/openjiuwen-runtime-foundation/d' pyproject.toml
RUN sed -i '/openjiuwen_runtime_management/d' packages/jiuwenclaw-ee/gateway/extensions/runtime_management_extension/pyproject.toml
# 构建期使用 uv(运行时 ExtensionLoader 同样依赖);要求构建机 docker >= 20.10.10
diff --git a/docker/openshift/Dockerfile.base b/docker/openshift/Dockerfile.base
new file mode 100644
index 0000000000..50191bf6d0
--- /dev/null
+++ b/docker/openshift/Dockerfile.base
@@ -0,0 +1,37 @@
+FROM registry.access.redhat.com/ubi9/python-311:latest
+
+USER root
+ARG PIP_EXTRA_ARGS="-i https://mirrors.aliyun.com/pypi/simple/"
+ARG ARCH=amd64
+
+RUN dnf remove -y subscription-manager || true
+
+# CRB:gcc / *-devel 头文件所在仓库
+RUN dnf install -y dnf-plugins-core \
+ && dnf config-manager --set-enabled ubi-9-codeready-builder-rpms || true
+
+RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm || true
+
+# 补齐缺失的工具(编译链/git/mariadb-connector 等已预装)
+RUN dnf install -y --allowerasing \
+ curl \
+ iputils \
+ nmap-ncat \
+ && dnf clean all \
+ && rm -rf /var/cache/dnf
+
+# 统一指向 python3.11
+RUN ln -sf /usr/bin/python3.11 /usr/local/bin/python3 \
+ && ln -sf /usr/bin/python3.11 /usr/local/bin/python \
+ && ln -sf /usr/bin/pip3.11 /usr/local/bin/pip3 \
+ && ln -sf /usr/bin/pip3.11 /usr/local/bin/pip
+
+# /opt/app-root 为 venv(不含系统 site-packages),前置 /usr/local/bin 使 python 命中系统环境
+ENV PATH=/usr/local/bin:$PATH
+
+# yq(mikefarah Go 版)
+RUN curl -fL https://openjiuwen-ci.obs.cn-north-4.myhuaweicloud.com/jiuwenclaw/software/yq_linux_${ARCH} \
+ -o /usr/local/bin/yq \
+ && chmod +x /usr/local/bin/yq
+
+RUN pip install --progress-bar off "uv>=0.9,<1.0" ${PIP_EXTRA_ARGS}
diff --git a/docker/openshift/Dockerfile.claw b/docker/openshift/Dockerfile.claw
new file mode 100644
index 0000000000..07235c3c96
--- /dev/null
+++ b/docker/openshift/Dockerfile.claw
@@ -0,0 +1,51 @@
+ARG BASE_IMAGE
+FROM ${BASE_IMAGE}
+
+USER root
+
+ARG AGENT_RUNTIME_REPOS=https://gitcode.com/openJiuwen/agent-runtime.git
+ARG AGENT_RUNTIME_BRANCH=develop
+ARG AGENT_CORE_REPOS=https://gitcode.com/openJiuwen/agent-core.git
+ARG AGENT_CORE_BRANCH=dev-stable
+ARG PIP_EXTRA_ARGS="-i https://mirrors.aliyun.com/pypi/simple/"
+
+# 业务用户 app(1000)
+RUN groupadd --gid 1000 app \
+ && useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash app \
+ && mkdir -p /app/jiuwenswarm /app/config /opt/tiktoken-cache \
+ && chown 1000:0 /app/jiuwenswarm /app/config /opt/tiktoken-cache /home/app \
+ && chmod -R g+rwX /app/jiuwenswarm /app/config /opt/tiktoken-cache /home/app
+
+WORKDIR /app/jiuwenswarm
+COPY --chown=1000:0 . /app/jiuwenswarm/
+RUN chgrp -R 0 /app/jiuwenswarm && chmod -R g+rwX /app/jiuwenswarm
+
+# openjiuwen 改由构建参数安装
+RUN sed -i '/openjiuwen-runtime-foundation/d' pyproject.toml
+RUN sed -i '0,/"openjiuwen @ git+/{/"openjiuwen @ git+/d;}' pyproject.toml
+RUN if [ -f packages/jiuwenclaw-ee/gateway/extensions/runtime_management_extension/pyproject.toml ]; then \
+ sed -i '/openjiuwen_runtime_management/d' packages/jiuwenclaw-ee/gateway/extensions/runtime_management_extension/pyproject.toml; \
+ fi
+
+RUN uv pip install --system \
+ -e . \
+ git+${AGENT_CORE_REPOS}@${AGENT_CORE_BRANCH} \
+ git+${AGENT_RUNTIME_REPOS}@${AGENT_RUNTIME_BRANCH}#subdirectory=foundation \
+ git+${AGENT_RUNTIME_REPOS}@${AGENT_RUNTIME_BRANCH}#subdirectory=management \
+ "rich>=13.7.0" \
+ ${PIP_EXTRA_ARGS}
+
+# tiktoken BPE 预热
+ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken-cache
+RUN python -c "import tiktoken; tiktoken.get_encoding('cl100k_base')"
+
+# symphony extension.yaml 存在才清理依赖
+RUN if [ -f jiuwenswarm/extensions/symphony/extension.yaml ]; then \
+ yq -i '.dependencies = {}' jiuwenswarm/extensions/symphony/extension.yaml; \
+ fi
+
+ENV HOME=/home/app \
+ PATH=/usr/local/bin:$PATH:/home/app/.local/bin
+USER 1000
+
+CMD ["/app/jiuwenswarm/docker/start.sh"]
diff --git a/docker/openshift/Dockerfile.web b/docker/openshift/Dockerfile.web
new file mode 100644
index 0000000000..fa7bc3840b
--- /dev/null
+++ b/docker/openshift/Dockerfile.web
@@ -0,0 +1,35 @@
+ARG NODE_IMAGE=node:20-alpine
+ARG NGINX_IMAGE=nginxinc/nginx-unprivileged:1.27-alpine
+
+# ---------- 阶段1:前端构建 ----------
+FROM ${NODE_IMAGE} AS web-builder
+
+ARG NPM_REGISTRY=https://registry.npmmirror.com
+ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
+
+WORKDIR /build/jiuwenswarm/channels/web/frontend
+COPY jiuwenswarm/channels/web/frontend/package.json \
+ jiuwenswarm/channels/web/frontend/package-lock.json ./
+RUN npm install
+
+COPY jiuwenswarm/channels/web/frontend/ ./
+COPY jiuwenswarm/scripts/ /build/jiuwenswarm/scripts/
+COPY jiuwenswarm/resources/ /build/jiuwenswarm/resources/
+RUN npm run build
+
+# ---------- 阶段2:nginx 运行 ----------
+FROM ${NGINX_IMAGE}
+
+USER root
+
+COPY docker/web.nginx.conf.template /etc/nginx/templates/default.conf.template
+COPY docker/web-optional-upstreams.sh /docker-entrypoint.d/40-optional-upstreams.sh
+RUN chmod +x /docker-entrypoint.d/40-optional-upstreams.sh \
+ && mkdir -p /etc/nginx/optional-upstreams \
+ && chown -R 101:0 /etc/nginx/optional-upstreams /docker-entrypoint.d \
+ && chmod -R g+rwX /etc/nginx/optional-upstreams /docker-entrypoint.d
+COPY --from=web-builder /build/jiuwenswarm/channels/web/frontend/dist \
+ /app/jiuwenswarm/jiuwenswarm/channels/web/frontend/dist
+
+USER 101
+EXPOSE 5173
diff --git a/docker/start.sh b/docker/start.sh
index c8d3dd4a19..cd6f38190b 100755
--- a/docker/start.sh
+++ b/docker/start.sh
@@ -18,7 +18,9 @@ fi
# 生成企业版配置(app 身份执行 → 覆盖上一步稀疏版;失败即退出,不 startup)
echo "[start.sh] generating config via update_conf.py"
echo "[start.sh] JIUWENSWARM_CONFIG_DIR='${JIUWENSWARM_CONFIG_DIR}'"
-if ! python3 "${SCRIPT_DIR}/update_conf.py"; then
+# 用绝对路径调用:UBI 镜像的 BASH_ENV 会激活 /opt/app-root venv,
+# 裸 python3 会命中 venv(无业务依赖);/usr/local/bin/python3 恒为系统 3.11
+if ! /usr/local/bin/python3 "${SCRIPT_DIR}/update_conf.py"; then
echo "[start.sh] update_conf.py FAILED" >&2
exit 1
fi