Merge branch 'main' of http://git.siriusliang.site/Gods/go_fish_web
commit
7ebb1ab648
@ -0,0 +1,64 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('📄文件信息') {
|
||||||
|
steps {
|
||||||
|
sh 'pwd'
|
||||||
|
sh 'ls -al'
|
||||||
|
echo '🚀开始推送文件到坤爷服务器'
|
||||||
|
sh 'scp Dockerfile root@47.109.22.188:~/go_fish_web'
|
||||||
|
sh 'scp nginx.conf root@47.109.22.188:~/go_fish_web'
|
||||||
|
echo '✨推送完成'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('🛠️构建项目') {
|
||||||
|
steps {
|
||||||
|
withDockerContainer('node:18-alpine') {
|
||||||
|
sh 'npm -v'
|
||||||
|
sh 'npm config set registry https://registry.npmmirror.com'
|
||||||
|
sh 'npm install'
|
||||||
|
sh 'npm run build'
|
||||||
|
sh 'ls -al'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('🎁打包制品'){
|
||||||
|
steps {
|
||||||
|
dir('dist') {
|
||||||
|
sh 'ls -al'
|
||||||
|
sh 'tar -zcvf go_fish_web.tar.gz *'
|
||||||
|
archiveArtifacts artifacts: 'go_fish_web.tar.gz',
|
||||||
|
allowEmptyArchive: true,
|
||||||
|
fingerprint: true,
|
||||||
|
onlyIfSuccessful: true
|
||||||
|
sh 'ls -al'
|
||||||
|
echo '🚀开始推送制品到坤爷服务器'
|
||||||
|
sh 'scp go_fish_web.tar.gz root@47.109.22.188:~/go_fish_web'
|
||||||
|
echo '✨推送完成'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('🏓远程部署') {
|
||||||
|
steps {
|
||||||
|
echo '🚀开始远程部署'
|
||||||
|
sh 'ssh root@47.109.22.188 "docker stop go_fish_web && docker rm go_fish_web && docker rmi go_fish_web && docker build -t go_fish_web ~/go_fish_web"'
|
||||||
|
sh 'ssh root@47.109.22.188 "docker run --restart=always --name go_fish_web -d -p 30030:80 -v /etc/localtime:/etc/localtime:ro go_fish_web"'
|
||||||
|
sh 'ssh root@47.109.22.188 "docker ps -a"'
|
||||||
|
echo '✨远程部署完成'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo 'Deployment successful!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'Deployment failed.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue