37 lines
1.5 KiB
Groovy
37 lines
1.5 KiB
Groovy
node {
|
|
checkout scm
|
|
docker.image('teracyangular-cli').inside() {
|
|
stage('build'){
|
|
sh 'npm config set registry httpregistry.npm.taobao.org'
|
|
sh 'npm install'
|
|
sh 'ng build'
|
|
}
|
|
}
|
|
|
|
|
|
def imagesName = '130.120.3.193com.gzzn.ommsadmin-web0.0.1-SNAPSHOT'
|
|
stage('Image Build And Push'){
|
|
docker.withRegistry('http130.120.3.193', 'privateDockerId') {
|
|
docker.build(imagesName).push()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
stage('deploy'){
|
|
def remote = []
|
|
remote.name = airport-dev
|
|
remote.host = 130.120.3.231
|
|
remote.allowAnyHosts = true
|
|
|
|
withCredentials([sshUserPrivateKey(credentialsId 'e41b57a4-436a-4617-817c-9e3f25a8a47f', keyFileVariable 'kfIdentity', passphraseVariable 'pVariable', usernameVariable 'userName')]) {
|
|
remote.user = userName
|
|
remote.identityFile = kfIdentity
|
|
|
|
sshCommand remote remote, command docker stop adminweb,sudo true ,failOnError false
|
|
sshCommand remote remote, command docker rm adminweb,sudo true ,failOnError false
|
|
sshCommand remote remote, command docker rmi 130.120.3.193com.gzzn.ommsadmin-web0.0.1-SNAPSHOT,sudo true ,failOnError false
|
|
sshCommand remote remote, command docker run -d -p 9680 --name adminweb 130.120.3.193com.gzzn.ommsadmin-web0.0.1-SNAPSHOT,sudo true
|
|
}
|
|
}
|
|
} |