1 Star 0 Fork 115

张文州/smart-city

forked from vitojc/smart-city 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Jenkinsfile 1.91 KB
Copy Edit Raw Blame History
wust authored 2020-06-18 06:54 . first
#!/usr/bin/env groovy
pipeline {
agent any
environment {
DEPLOY_IP_LIST = ""
}
stages {
stage('编译打包') {
steps {
echo "==========编译开始=========="
sh "mvn clean package -Dmaven.test.skip=true"
echo "==========编译结束=========="
}
}
stage('构建镜像') {
steps {
echo "==========构建镜像开始=========="
sh '''
for element in `find /var/lib/jenkins/workspace/sc -name 'Dockerfile'`
do
echo ${element%/*}
cd ${element%/*}
mvn clean package dockerfile:build
done
'''
echo "==========构建镜像结束=========="
}
}
stage('发布镜像') {
steps {
echo "==========发布镜像开始=========="
sh '''
for element in `find /var/lib/jenkins/workspace/sc -name 'Dockerfile'`
do
echo ${element%/*}
cd ${element%/*}
mvn clean package dockerfile:push
done
'''
echo "==========发布镜像结束=========="
}
}
stage('部署服务') {
steps {
echo "==========部署服务开始=========="
sh '''
ips=("ip1" "ip2")
for element in ${ips[@]}
do
echo $element
sudo ssh ${element} -t 'cd /data; ls; docker-compose stop; docker-compose up -d; bash --login\'
done
'''
echo "==========部署服务结束=========="
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/zhwzh/smart-city.git
git@gitee.com:zhwzh/smart-city.git
zhwzh
smart-city
smart-city
master

Search