From 1019d33db6195aa68e3d468cb25869cc2809b066 Mon Sep 17 00:00:00 2001 From: Bruce Chen <805899926@qq.com> Date: Fri, 17 May 2024 11:59:50 +0800 Subject: [PATCH] # --- server/docker/doc-template.md | 3 +++ server/docker/main.py | 1 + server/share.sh | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/docker/doc-template.md b/server/docker/doc-template.md index d9315065e..8b91c0e4d 100644 --- a/server/docker/doc-template.md +++ b/server/docker/doc-template.md @@ -13,6 +13,9 @@ {%- endif %} {%- if param_docker_compose_command %} ## docker-compose +```yaml +{{ param_docker_compose_content }} +``` ```bash {{ param_docker_compose_command }} ``` diff --git a/server/docker/main.py b/server/docker/main.py index bf9c5b750..97bfa09ba 100644 --- a/server/docker/main.py +++ b/server/docker/main.py @@ -110,6 +110,7 @@ def build(self) -> list[str]: md_content = template_util.Template(file_util.read_text(self.root_doc_template_file)).render(**{ "param_registry_git_repo_dict": {t["name"]: "{}/{}/{}".format(t["url"], "tree/main", self.role_name) for t in self.role_env.get("param_registry_git_repos")}, "param_docker_dockerfile_dict": rdd, + "param_docker_compose_content": file_util.read_text(self.role_deploy_file) if self.role_deploy_file.exists() else None, "param_docker_compose_command": docker_compose_command if self.role_deploy_file.exists() else None, }) file_util.write_text(self.role_output_path.joinpath("doc.md"), md_content) diff --git a/server/share.sh b/server/share.sh index a216a140e..d50949da6 100755 --- a/server/share.sh +++ b/server/share.sh @@ -68,5 +68,5 @@ tar -zcf - --exclude="__pycache__" --exclude="${build_name}" \ -C $(realpath ${src_path}/../../) ${src_path_server_files} \ | ${host_cmd} "mkdir -p \$HOME/${dst_name};tar -zxf - -C \$HOME/${dst_name}" ${host_cmd} "${cmd}" -${host_cmd} "[ -d $HOME/${dst_name} ]" && ${host_cmd} "tar -zcf - -C \$HOME/${dst_name} ${tmp_name} ${build_name}" | tar -zxf - -C ${src_path} +${host_cmd} "[ -d \$HOME/${dst_name} ]" && ${host_cmd} "tar -zcf - -C \$HOME/${dst_name} ${tmp_name} ${build_name}" | tar -zxf - -C ${src_path} ${host_cmd} "${del_cmd}" \ No newline at end of file