From 754799a259fcbe1d8df05c01cc27563a7776c684 Mon Sep 17 00:00:00 2001 From: senatorovv <61406888+senatorovv@users.noreply.github.com> Date: Wed, 12 Jul 2023 11:54:47 +0400 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index da3547016..ded6cd5a6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,28 @@ #!groovy + pipeline { - agent none - stages { + agent none stages { stage('Maven Install') { - agent any + agent any + steps { sh 'mvn clean install' } } + stage('Docker Build') { + agent any + steps { + sh 'docker build -t registry.hub.docker.com/hybrid2k3/petclinic:1 .' + } + } + stage('Docker Push') { + agent any + steps { + withCredentials([usernamePassword(credentialsId: 'dockerHub', passwordVariable: 'dockerHubPassword', usernameVariable: 'dockerHubUser')]) { + sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPassword}" + sh 'registry.hub.docker.com/hybrid2k3/petclinic:1' + } + } + } } }