Skip to content

Commit c94a6c5

Browse files
authored
fix jupyter build (#198)
* fix jupyter build * fix model build
1 parent cddb45e commit c94a6c5

File tree

8 files changed

+39
-27
lines changed

8 files changed

+39
-27
lines changed

.github/workflows/docker_jupyter_base_image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
echo "* Manual build wedpr-jupyter-image image, docker version: ${{ github.event.inputs.tags }}"
3434
DOCKER_TAG="fiscoorg/wedpr-jupyter-image:${{ github.event.inputs.tags }}"
3535
echo "* Begin to build ${DOCKER_TAG}"
36-
cd docker-files/base
36+
cd docker-files/jupyter
3737
docker build -t ${DOCKER_TAG} .
3838
echo "* Build ${DOCKER_TAG} success"
3939
docker push ${DOCKER_TAG}

docker-files/jupyter/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ficoorg/wedpr-image:v3.0.0 as wedpr-jupyter-image
1+
FROM fiscoorg/wedpr-image:v3.0.0 as wedpr-jupyter-image
22

33
ENV LANG zh_CN.UTF-8
44
ENV LANGUAGE zh_CN.UTF-8

docker-files/site/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ FROM fiscoorg/wedpr-image:v3.0.0 as wedpr-pir
4141
LABEL maintainer service@webank.com
4242

4343
RUN mkdir -p /data/home/wedpr
44-
COPY --from=builder /WeDPR/wedpr-pir/dist/ /data/app/wedpr-pir
44+
COPY --from=builder /WeDPR/wedpr-pir/dist/ /data/home/wedpr/wedpr-pir
4545
ENTRYPOINT ["/bin/bash", "/data/home/wedpr/wedpr-pir/start.sh", "true"]
4646

4747
# the wedpr-site

wedpr-builder/wedpr_builder/common/constant.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class ConfigInfo:
8383
wedpr_pir_docker_dir = "wedpr-pir"
8484
wedpr_site_docker_dir = "wedpr-site"
8585
wedpr_mpc_docker_dir = "wedpr-mpc-service"
86+
wedpr_model_docker_dir = "wedpr-model"
8687

8788
wedpr_gateway_service_dir = "wedpr-gateway-service"
8889
wedpr_node_service_dir = "wedpr-pro-node-service"
@@ -110,6 +111,7 @@ class ConfigInfo:
110111
scripts_file_list = ["start.sh", "stop.sh"]
111112
# the default path for docker
112113
default_spdz_home = "/data/app/wedpr/scripts/wedpr-mpc-no-gateway"
114+
cpp_component_cmd = " -c config.ini "
113115

114116
@staticmethod
115117
def get_docker_path(file_path: str):
@@ -177,6 +179,7 @@ class ConfigProperities:
177179
WEDPR_LOG_DIR = "WEDPR_LOG_DIR"
178180
# specify the mounted docker log path
179181
DOCKER_LOG_PATH = "DOCKER_LOG_PATH"
182+
DOCKER_CMD = "DOCKER_CMD"
180183
# specify the exposed docker port list
181184
WEDPR_DOCKER_EXPORSE_PORT_LIST = "WEDPR_DOCKER_EXPORSE_PORT_LIST"
182185
# the created docker name

wedpr-builder/wedpr_builder/config/wedpr_deploy_config.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,12 @@ def to_properties(self) -> {}:
867867
{constant.ConfigProperities.WEDPR_API_TOKEN: self.wedpr_api_token})
868868
# EXTENDED_MOUNT_CONF default is empty string
869869
props.update({constant.ConfigProperities.EXTENDED_MOUNT_CONF: ""})
870+
props.update({constant.ConfigProperities.DOCKER_CMD: ""})
870871
return props
871872

872873
def get_wedpr_model_properties(self, deploy_ip: str, node_index: int) -> {}:
873874
props = self.to_properties()
875+
prefix_path = constant.ConfigInfo.wedpr_model_docker_dir
874876
# the zone config
875877
props.update(self.env_config.to_properties())
876878
# the sql config
@@ -884,21 +886,25 @@ def get_wedpr_model_properties(self, deploy_ip: str, node_index: int) -> {}:
884886
props.update(
885887
{constant.ConfigProperities.WEDPR_CONFIG_DIR: "application.yml"})
886888
props.update(
887-
{constant.ConfigProperities.DOCKER_CONF_PATH: constant.ConfigInfo.get_docker_path("model/application.yml")})
889+
{constant.ConfigProperities.DOCKER_CONF_PATH: constant.ConfigInfo.get_docker_path(f"{prefix_path}/application.yml")})
888890
# the extended mount info
889891
local_path = "${SHELL_FOLDER}/logging.conf"
890-
docker_path = constant.ConfigInfo.get_docker_path("model/logging.conf")
892+
docker_path = constant.ConfigInfo.get_docker_path(os.path.join(
893+
prefix_path, "logging.conf"))
891894
extended_mount_info = f" -v {local_path}:{docker_path} "
892895
local_path = "${SHELL_FOLDER}/wedpr_sdk_log_config.ini"
893896
docker_path = constant.ConfigInfo.get_docker_path(
894-
"model/wedpr_sdk_log_config.ini")
897+
os.path.join(prefix_path, "wedpr_sdk_log_config.ini"))
895898
extended_mount_info = f"{extended_mount_info} -v {local_path}:{docker_path} "
899+
# set the working directory
900+
working_dir = constant.ConfigInfo.get_docker_path(prefix_path)
901+
extended_mount_info = f"{extended_mount_info} -w {working_dir}"
896902
props.update(
897903
{constant.ConfigProperities.EXTENDED_MOUNT_CONF: extended_mount_info})
898904
# set the log mount information
899905
props.update({constant.ConfigProperities.WEDPR_LOG_DIR: "logs"})
900906
props.update({constant.ConfigProperities.DOCKER_LOG_PATH:
901-
constant.ConfigInfo.get_docker_path("model/logs")})
907+
constant.ConfigInfo.get_docker_path(f"{constant.ConfigInfo.wedpr_model_docker_dir}/logs")})
902908
return props
903909

904910
@staticmethod
@@ -907,26 +913,20 @@ def generate_cpp_component_docker_properties(
907913
prefix_path, zone_name: str, service_type: str, env_config,
908914
exposed_port_list: str, node_index: int):
909915
props = {}
910-
# the config mount info
916+
# the config mount info: mount the whole directory
911917
props.update(
912-
{constant.ConfigProperities.WEDPR_CONFIG_DIR: "config.ini"})
913-
path = constant.ConfigInfo.get_docker_path(f"{prefix_path}/config.ini")
918+
{constant.ConfigProperities.WEDPR_CONFIG_DIR: ""})
919+
path = constant.ConfigInfo.get_docker_path(f"{prefix_path}/")
914920
props.update(
915921
{constant.ConfigProperities.DOCKER_CONF_PATH: path})
916-
# set the extended mont config
917-
local_mount_dir = '${SHELL_FOLDER}/conf'
918-
remote_mount_dir = constant.ConfigInfo.get_docker_path(
919-
f"{prefix_path}/conf")
920-
extended_mount_conf = f" -v {local_mount_dir}:{remote_mount_dir} "
921-
# nodes.json for gateway service
922-
if service_type == constant.ServiceInfo.gateway_service_type:
923-
node_connection_file = "nodes.json"
924-
local_mount_dir = '${SHELL_FOLDER}/%s' % node_connection_file
925-
remote_mount_dir = constant.ConfigInfo.get_docker_path(
926-
f"{prefix_path}/{node_connection_file}")
927-
extended_mount_conf = f"{extended_mount_conf} -v {local_mount_dir}:{remote_mount_dir} "
922+
# set the working directory
923+
working_dir = constant.ConfigInfo.get_docker_path(f"{prefix_path}")
924+
extended_mount_conf = f" -w {working_dir}"
928925
props.update(
929926
{constant.ConfigProperities.EXTENDED_MOUNT_CONF: extended_mount_conf})
927+
# specify the cmd
928+
props.update(
929+
{constant.ConfigProperities.DOCKER_CMD: f"{constant.ConfigInfo.cpp_component_cmd}"})
930930
# specify the log path to mount
931931
props.update({constant.ConfigProperities.WEDPR_LOG_DIR: "log"})
932932
props.update({constant.ConfigProperities.DOCKER_LOG_PATH:
@@ -1032,16 +1032,24 @@ def get_mpc_properties(self, deploy_ip: str, node_index: int):
10321032
# the config mount info
10331033
docker_prefix_path = constant.ConfigInfo.wedpr_mpc_docker_dir
10341034
props.update(
1035-
{constant.ConfigProperities.WEDPR_CONFIG_DIR: "config.ini"})
1035+
{constant.ConfigProperities.WEDPR_CONFIG_DIR: ""})
10361036
path = constant.ConfigInfo.get_docker_path(
1037-
f"{docker_prefix_path}/config.ini")
1037+
f"{docker_prefix_path}")
10381038
props.update(
10391039
{constant.ConfigProperities.DOCKER_CONF_PATH: path})
10401040

10411041
# specify the log path to mount
10421042
props.update({constant.ConfigProperities.WEDPR_LOG_DIR: "log"})
10431043
props.update({constant.ConfigProperities.DOCKER_LOG_PATH:
10441044
constant.ConfigInfo.get_docker_path(f"{docker_prefix_path}/log")})
1045+
# specify the extended mount info
1046+
working_directory = constant.ConfigInfo.get_docker_path(
1047+
docker_prefix_path)
1048+
props.update(
1049+
{constant.ConfigProperities.EXTENDED_MOUNT_CONF: f" -w {working_directory}"})
1050+
# specify the docker command
1051+
props.update(
1052+
{constant.ConfigProperities.DOCKER_CMD: constant.ConfigInfo.cpp_component_cmd})
10451053
return props
10461054

10471055
def __update_dml__(self, sql, dml_file_path, use_double_quote=False):

wedpr-builder/wedpr_builder/generator/wedpr_service_generator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def __generate_single_node_config__(
118118
utilities.mkdir(node_path)
119119
# copy configuration into the dest path
120120
command = f"cp -r {service_config.tpl_config_file_path} {node_path}"
121-
if service_config.service_type == constant.ServiceInfo.wedpr_model_service:
121+
if service_config.service_type == constant.ServiceInfo.wedpr_model_service \
122+
or service_config.service_type == constant.ServiceInfo.wedpr_mpc_service:
122123
command = f"cp {service_config.tpl_config_file_path}/* {node_path}"
123124
(ret, output) = utilities.execute_command_and_getoutput(command)
124125
if ret is False:

wedpr-builder/wedpr_builder/tpl/docker/create_docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [[ "${confirm}" == "Y" || "${confirm}" == "y" ]]; then
1515
LOG_INFO "* Pull image ${WEDPR_IMAGE_DESC}"
1616
docker pull ${WEDPR_IMAGE_DESC}
1717
LOG_INFO "* Pull image ${WEDPR_IMAGE_DESC} success, begin to create docker"
18-
docker run -d ${WEDPR_DOCKER_EXPORSE_PORT_LIST} -v ${SHELL_FOLDER}/${WEDPR_CONFIG_DIR}:${DOCKER_CONF_PATH} -v ${SHELL_FOLDER}/${WEDPR_LOG_DIR}:${DOCKER_LOG_PATH} ${EXTENDED_MOUNT_CONF} --name ${WEDPR_DOCKER_NAME} ${WEDPR_IMAGE_DESC}
18+
docker run -d ${WEDPR_DOCKER_EXPORSE_PORT_LIST} -v ${SHELL_FOLDER}/${WEDPR_CONFIG_DIR}:${DOCKER_CONF_PATH} -v ${SHELL_FOLDER}/${WEDPR_LOG_DIR}:${DOCKER_LOG_PATH} ${EXTENDED_MOUNT_CONF} --name ${WEDPR_DOCKER_NAME} ${WEDPR_IMAGE_DESC} ${DOCKER_CMD}
1919
LOG_INFO "Create docker: ${WEDPR_DOCKER_NAME} success"
2020
else
2121
LOG_INFO "Exit without create docker ${WEDPR_DOCKER_NAME}"

wedpr-builder/wedpr_builder/tpl/model/conf/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ transport_threadpool_size: 4
3535
transport_node_id: "${WEDPR_NODE_ID}"
3636
transport_gateway_targets: "${GATEWAY_TARGET}"
3737
transport_host_ip: "${WEDPR_TRANSPORT_HOST_IP}"
38-
transport_listen_port: ${WEDPR_SERVER_LISTEN_PORT}
38+
transport_listen_port: ${WEDPR_TRANSPORT_LISTEN_PORT}
3939

4040
# the log retriever config
4141
LOG_PATH: "logs/wedpr-model.log"

0 commit comments

Comments
 (0)