jenkins远程部署vue项目

前置步骤参考 –> jenkins远程部署java项目

构建 shell 命令

echo $PATH
echo '>>> cnpm run build'

sudo cnpm install
sudo rm -rf dist/*
sudo npm run build --prod
cd dist
zip -r dist.zip ./* 
echo '>>> end local shell'

构建后操作

** Send build artifacts over SSH**

#!/bin/bash
#!/bin/bash
basePath=/opt/edu/nginx/web/crm
tempDistPath=/opt/edu/nginx/web/crm/temp
dockerContainerName=nginx-edu

echo '>>> START exec  remote shell'

echo '>>> delete old dist'
sudo rm -rf `ls $basePath  | grep -v "temp"`||true

echo '>>> unzip dist.zip -d  ../'
sudo  cd  $tempDistPath
sudo  unzip dist.zip -d  ../

echo '>>> restart nginx-edu '
sudo docker restart $dockerContainerName

sudo  rm  $tempDistPath/dist.zip

    原文作者:笨蛋炒面
    原文地址: https://www.jianshu.com/p/80c1adb8400a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞