2eb5366a by Israel do Amaral Santiago

Jenkins File

1 parent 831d85d6
1 pipeline {
2 agent any
3
4 environment {
5 registry = "israeldoamaral/app01"
6 registryCredential = 'dockerhub_id'
7 dockerImage = ''
8 }
9
10 stages {
11 stage('Build Docker Image') {
12 steps {
13 script {
14 dockerImage = docker.build registry + ":develop"
15 }
16 }
17 }
18 stage('Send image to Docker Hub') {
19 steps {
20 script {
21 docker.withRegistry( '', registryCredential ) {
22 dockerImage.push()
23 }
24 }
25 }
26 }
27 stage('Cleaning up') {
28 steps {
29 sh "docker rmi $registry:develop"
30 }
31 }
32 }
33 }
34 def remote = [:]
35 remote.name = "suporte"
36 remote.host = "172.25.45.103"
37 remote.allowAnyHosts = true
38
39 node {
40 withCredentials([sshUserPrivateKey(credentialsId: 'suporte-id', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'suporte')]) {
41 remote.user = suporte
42 remote.identityFile = identity
43 stage("SSH Steps Rocks!") {
44 sshScript remote: remote, script: 'scripts/stop-container.sh'
45 sshScript remote: remote, script: 'scripts/start-container.sh'
46
47 }
48 }
49 }
...\ No newline at end of file ...\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!