你好有同样的问题首先构建 kie 路由器图像:你需要有 kie 智能路由器 jar,你可以从 Redhat 站点下载它
####### BASE ############
FROM jboss/base-jdk:8
####### ENVIRONMENT ############
ENV ROUTER_HOME=/opt/jboss \
KIE_SERVER_ROUTER_REPO_DIR=/opt/jboss \
ROUTER_HOSTNAME_EXTERNAL=http://localhost:9000/
# ENV KIE_SERVER_CONTROLLER
ENV KIE_SERVER_CONTROLLER_USER admin
ENV KIE_SERVER_CONTROLLER_PWD admin
####### EXPOSE ROUTER PORT ############
EXPOSE 9000
####### Kie server router CUSTOM CONFIGURATION ############
ADD kie-server-router.jar $ROUTER_HOME/kie-server-router.jar
ADD start_kie-server-router.sh $ROUTER_HOME/start_kie-server-router.sh
###### SWITCH USER root ######
USER root
###### CHANGE FILE PROPERTIES ######
RUN chmod +x $ROUTER_HOME/start_kie-server-router.sh
RUN chgrp -R 0 /opt/jboss
RUN chmod -R g+rw /opt/jboss
RUN find /opt/jboss -type d -exec chmod g+x {} +
####### CUSTOM JBOSS USER ############
# Switchback to jboss user
USER jboss
####### RUNNING Kie server router ############
WORKDIR $ROUTER_HOME
CMD ["./start_kie-server-router.sh"
start_kie-server-router.sh :
#!/usr/bin/env bash
# Default arguments for running the KIE Execution server.
ROUTER_ARGUMENTS="-Dorg.kie.server.router.host=$HOSTNAME -Dorg.kie.server.router.port=9000 -Dorg.kie.server.router.repo=$KIE_SERVER_ROUTER_REPO_DIR -Dorg.kie.server.router.url.external=$ROUTER_HOSTNAME_EXTERNAL"
# Controller argument for the KIE Server router. Only enabled if set the environment variable/s or detected container linking.
if [ -n "$KIE_SERVER_CONTROLLER" ]; then
echo "Using '$KIE_SERVER_CONTROLLER' as KIE server controller"
ROUTER_ARGUMENTS="$ROUTER_ARGUMENTS -Dorg.kie.server.controller=$KIE_SERVER_CONTROLLER -Dorg.kie.server.controller.user=$KIE_SERVER_CONTROLLER_USER -Dorg.kie.server.controller.pwd=$KIE_SERVER_CONTROLLER_PWD"
fi
echo "Router arguments '$ROUTER_ARGUMENTS' "
exec java -jar $ROUTER_ARGUMENTS $ROUTER_HOME/kie-server-router.jar
exit $?
构建 kie 服务器映像,您将在其中使用智能路由器选项克隆此 repo:https ://github.com/jboss-dockerfiles/business-central/tree/master/kie-server/showcase
在 Dockerfile 中编辑
ENV KIE_SERVER_LOCATION http://kie-server:8080/kie-server/services/rest/server
在 start_kie-server.sh 添加
# If Kie server router is configured then use it
if [ -n "$KIE_SERVER_ROUTER" ]; then
echo "Using '$KIE_SERVER_ROUTER' as KIE server router"
JBOSS_ARGUMENTS="$JBOSS_ARGUMENTS -Dorg.kie.server.router=$KIE_SERVER_ROUTER"
fi
最后 docker compose
business-central:
image: jboss/business-central-workbench-showcase
container_name: business-central
ports:
- 8080:8080
- 8001:8001
kie-server:
image: jboss/kie-server-showcase:{yourTag}
container_name: kie-server
environment:
KIE_MAVEN_REPO: http://nexus:8081/repository/rules
JVM_OPTS: -Xmx1g -Xms1g
KIE_SERVER_CONTROLLER: http://business-central:8080/business-central/rest/controller
KIE_SERVER_ROUTER: http://kie-smart-router:9000
depends_on:
- nexus
- business-central
- kie-smart-router
ports:
- 8180:8080
kie-smart-router:
image: jboss/kie-smart-router:latest
container_name: kie-smart-router
environment:
KIE_SERVER_CONTROLLER: http://business-central:8080/business-central/rest/controller
depends_on:
- business-central
ports:
- 9000:9000