2eb5366a by Israel do Amaral Santiago

Jenkins File

1 parent 831d85d6
pipeline {
agent any
environment {
registry = "israeldoamaral/app01"
registryCredential = 'dockerhub_id'
dockerImage = ''
}
stages {
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'
}
}
}
\ 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!