From c7023de05cc0dc32a5e5fa081c087ca6c0ef29be Mon Sep 17 00:00:00 2001 From: RolandBakunts Date: Tue, 17 Jan 2023 04:20:03 -0800 Subject: [PATCH] JenkinsFile docker configuration --- Jenkinsfile | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 046b9951f..bf5ec9bbb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,11 @@ pipeline { + + environment { + registry = "rolandgryddynamics/mr" + registryCredential = 'dockerhub_id' + dockerImage = '' + } + agent { node { label 'ubuntu-master' @@ -22,27 +29,21 @@ pipeline { // } // } - stage('docker') { - steps { - script { - sh 'docker version' - app = docker.build("rolandgryddynamics/mr") - // sh 'docker build -t my/app .' - - // sh 'docker tag my/app rolandgryddynamics/mr' - // sh 'docker tag push rolandgryddynamics/mr' + stage('Building docker image') { + steps { + script { + dockerImage = docker.build registry + ":$BUILD_NUMBER" } - } + } } - stage('deploy to dockerhub') { - steps { - script { - echo 'jelllkdskdks' - docker.withRegistry("https://registry.hub.docker.com", "webserver_login") - app.push("${env.BUILD_NUMBER}") - app.push("latest") - } + stage('Deploy our image') { + steps { + script { + docker.withRegistry( '', registryCredential ) { + dockerImage.push() + } + } } - } + } } } \ No newline at end of file