This commit is contained in:
vipg
2025-10-09 12:32:56 +08:00
parent 44b9fa3183
commit a22f865f71
13 changed files with 10 additions and 24 deletions

Binary file not shown.

View File

@@ -103,6 +103,16 @@ def execute_release_scripts(root_dir: str) -> bool:
# 复制后确保目标文件可读写
os.chmod(dest_path, 0o644)
print(f"已将 {src_path} 替换复制到 {dest_path}")
# 复制成功后删除原文件
try:
os.remove(src_path)
print(f"已删除原文件: {src_path}")
except PermissionError:
print(f"警告:无权限删除原文件 {src_path},请手动清理")
except Exception as e:
print(f"删除原文件 {src_path} 时发生错误: {str(e)}")
except PermissionError:
print(f"错误:复制 {src_path} 失败(权限不足)")
print("建议:使用 sudo 权限重新运行脚本sudo python3 build.py")
@@ -119,7 +129,6 @@ def execute_release_scripts(root_dir: str) -> bool:
def merge_yaml_files(root_dir: str) -> Dict[str, Any]:
"""合并所有 docker-compose 相关 YAML 文件内容排除api_template"""
merged = {
'version': '3.8',
'services': {},
'networks': {},
'volumes': {}
@@ -158,8 +167,6 @@ def merge_yaml_files(root_dir: str) -> Dict[str, Any]:
merged['networks'].update(data['networks'])
if 'volumes' in data:
merged['volumes'].update(data['volumes'])
if 'version' in data and data['version'] > merged['version']:
merged['version'] = data['version']
except yaml.YAMLError as e:
print(f"解析 {file_path} 失败: {e}")
@@ -170,26 +177,6 @@ def merge_yaml_files(root_dir: str) -> Dict[str, Any]:
return merged
def stop_docker_compose(root_dir: str) -> bool:
"""停止docker-compose"""
print("开始停止docker-compose...")
compose_file = os.path.join(root_dir, 'docker-compose.yaml')
if not os.path.exists(compose_file):
print(f"未找到docker-compose文件: {compose_file}")
return False
return run_shell_command(f"sudo docker-compose -f {compose_file} down", root_dir)
def start_docker_compose(root_dir: str) -> bool:
"""启动docker-compose"""
print("开始启动docker-compose...")
compose_file = os.path.join(root_dir, 'docker-compose.yaml')
if not os.path.exists(compose_file):
print(f"未找到docker-compose文件: {compose_file}")
return False
return run_shell_command(f"sudo docker-compose -f {compose_file} up -d", root_dir)
def main():
# 先执行清除虚悬镜像操作
print("部署流程开始,先执行清除虚悬镜像操作...")

BIN
deploy/images/user-login-api-1.0.0.tar Executable file → Normal file

Binary file not shown.

View File

@@ -1,4 +1,3 @@
version: '3.8'
services:
pgadmin:
image: dpage/pgadmin4:9.5.0