Jenkinsfile.bkp
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
pipeline {
agent any
environment {
registry = "israeldoamaral/app01"
registryCredential = 'dockerhub_id'
dockerImage = ''
}
stages {
// stage('Clone Repository') {
// steps {
// git url: 'http://cidsrvgit.cidades/israel/app01.git'
// }
// }
stage('Build Docker Image') {
steps {
script {
dockerImage = docker.build registry + ":develop"
}
}
}
stage('Send image to Docker Hub') {
steps {
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}
}
}
}
stage('Cleaning up') {
steps {
sh "docker rmi $registry:develop"
}
}
}
}
def remote = [:]
remote.name = "suporte"
remote.host = "172.25.45.103"
remote.allowAnyHosts = true
node {
withCredentials([sshUserPrivateKey(credentialsId: 'suporte-id', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'suporte')]) {
remote.user = suporte
remote.identityFile = identity
stage("SSH Steps Rocks!") {
sshScript remote: remote, script: 'scripts/stop-container.sh'
sshScript remote: remote, script: 'scripts/start-container.sh'
}
}
}