From abbbb68290ec6adad10502f652459e101d4687ad Mon Sep 17 00:00:00 2001 From: andyjk15 Date: Fri, 14 Feb 2020 17:48:09 +0000 Subject: [PATCH] [14.02.20] playing with docker registry push --- configuration/pipelines/build.groovy | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/configuration/pipelines/build.groovy b/configuration/pipelines/build.groovy index b907459..b5e109e 100644 --- a/configuration/pipelines/build.groovy +++ b/configuration/pipelines/build.groovy @@ -61,8 +61,6 @@ try { stage('Build Image') { mvn 'clean package -DskipTests' - sh "docker build -t db-gateway:${env.APPLICATION_VERSION} -f Dockerfile ." - // Update build config for kubernetes // Update Service yaml for kubernetes // Update route yaml for kubernetes @@ -78,10 +76,18 @@ try { } stage('Tag Repository') { - sh "docker tag db-gateway:${env.APPLICATION_VERSION} ${env.DOCKER_REPOSITORY_URL}/db-gateway:${env.APPLICATION_VERSION}" - withDockerRegistry([ credentialsId: 'Registry', url: "${env.DOCKER_REPOSITORY_URL}"]) { - sh "docker push ${env.DOCKER_REPOSITORY_URL}/db-gateway:${env.APPLICATION_VERSION}" + + withDockerServer([uri: "tcp://registry.cryptosky.me:4243"]) { + withDockerRegistry([credentialsId: 'Registry', url: "${env.DOCKER_REPOSITORY_URL}"]) { + // we give the image the same version as the .war package + def image = docker.build("${env.DOCKER_REPOSITORY}/db-gateway:${env.APPLICATION_VERSION}") + image.push() } + } +// sh "docker tag db-gateway:${env.APPLICATION_VERSION} ${env.DOCKER_REPOSITORY_URL}/db-gateway:${env.APPLICATION_VERSION}" +// withDockerRegistry([ credentialsId: 'Registry', url: "${env.DOCKER_REPOSITORY_URL}"]) { +// sh "docker push ${env.DOCKER_REPOSITORY_URL}/db-gateway:${env.APPLICATION_VERSION}" +// } } } }