[14.02.20] playing with docker registry push

This commit is contained in:
andyjk15 2020-02-14 17:48:09 +00:00
parent 04372347f2
commit abbbb68290

View File

@ -61,8 +61,6 @@ try {
stage('Build Image') { stage('Build Image') {
mvn 'clean package -DskipTests' mvn 'clean package -DskipTests'
sh "docker build -t db-gateway:${env.APPLICATION_VERSION} -f Dockerfile ."
// Update build config for kubernetes // Update build config for kubernetes
// Update Service yaml for kubernetes // Update Service yaml for kubernetes
// Update route yaml for kubernetes // Update route yaml for kubernetes
@ -78,10 +76,18 @@ try {
} }
stage('Tag Repository') { 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}"]) { withDockerServer([uri: "tcp://registry.cryptosky.me:4243"]) {
sh "docker push ${env.DOCKER_REPOSITORY_URL}/db-gateway:${env.APPLICATION_VERSION}" 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}"
// }
} }
} }
} }