Sailsjs – 如何打包应用程序

我正在开发一个风帆应用程序。

目前,要移动到另一台服务器。

我必须经过三个步骤:

第1步 :签出源代码。

第二步 :运行npm install来下载依赖

第3步 :通过cmd sails lift --prod部署sails lift --prod应用程序

有没有什么办法可以将.zip压缩到服务器并运行cmd deploy?

我的目的是:

第一步 :将全部文件压缩到1个文件夹

第二步 :上传并部署

无需安装依赖手册

像java分发的方式>构build一个war文件并放入tomcat

或者Angular CLI将所有文件都编译到dist文件夹

谢谢

你可以使用Jenkinspipe道和shell脚本来实现它。

  1. 创build一个jenkinspipe道
  2. 构build一个zip文件并将其推送到某个存储。 (Amazon S3?)
  3. 执行shell脚本ssh到生产服务器并执行另一个从S3下载最新版本的shell脚本,安装依赖关系,然后启动应用程序。

示例Jenkinsfile:

  pipeline { agent any stages { stage('Build') { steps { checkout scm echo 'Zipping..' sh 'echo "My-app-`date +"%Y-%m-%dT%H-%M-%S"`.zip" >> buildName.txt' sh 'if [ -d .git ]; then echo "Removing git folder"; rm -r .git/ ; fi;' sh 'zip -r `cat buildName.txt` .' archiveArtifacts artifacts: '*.zip' } } stage('Test') { steps { echo 'test..' } } stage('Upload') { steps { echo 'uploading..' sh 's3cmd put `cat buildName.txt` s3://my-app-builds' } } stage('Deploy') { steps { echo 'Deploying....' sh './deploy_to_production.sh' } } } } 

否则你可以dockerize应用程序。