|
|
|
@ -88,6 +88,16 @@ def main():
|
|
|
|
|
# 激活虚拟环境并安装依赖
|
|
|
|
|
cmd = f'{venv_path}/bin/pip install -r {remote_path}/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple'
|
|
|
|
|
execute_remote_command(ssh, cmd)
|
|
|
|
|
|
|
|
|
|
# 构建镜像
|
|
|
|
|
cmd='docker build --no-cache --build-arg PYTHON_VERSION=3.10 --build-arg APP_ENV=prod -t data-sync-service:1.0 .'
|
|
|
|
|
execute_remote_command(ssh, cmd)
|
|
|
|
|
|
|
|
|
|
# 启动镜像
|
|
|
|
|
cmd='docker run -it --rm data-sync-service:1.0'
|
|
|
|
|
execute_remote_command(ssh, cmd)
|
|
|
|
|
|
|
|
|
|
print("上传完成")
|
|
|
|
|
finally:
|
|
|
|
|
# 关闭 SFTP 和 SSH 连接
|
|
|
|
|
sftp.close()
|
|
|
|
|