26 lines
1.4 KiB
Groovy
26 lines
1.4 KiB
Groovy
node {
|
|
checkout scm
|
|
docker.image('maven:3-alpine').inside('-v /root/.m2:/root/.m2') {
|
|
stage('build'){
|
|
sh 'mvn clean package dockerfile:build dockerfile:push -Dmaven.test.skip=true'
|
|
}
|
|
|
|
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 adminapi",sudo: true ,failOnError: false
|
|
sshCommand remote: remote, command: "docker rm adminapi",sudo: true ,failOnError: false
|
|
sshCommand remote: remote, command: "docker rmi 130.120.3.193/com.gzzn.omms/admin-api:0.0.1-SNAPSHOT",sudo: true ,failOnError: false
|
|
sshCommand remote: remote, command: "docker pull 130.120.3.193/com.gzzn.omms/admin-api:0.0.1-SNAPSHOT" ,sudo: true
|
|
sshCommand remote: remote, command: "docker run -d -p 91:8080 --name adminapi 130.120.3.193/com.gzzn.omms/admin-api:0.0.1-SNAPSHOT",sudo: true
|
|
}
|
|
}
|
|
}
|
|
} |