jenkins远程部署vue项目

2018-09-10  本文已影响0人  炒面Z

前置步骤参考 --> 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

上一篇下一篇

猜你喜欢

热点阅读