From 1e4ed072bc4a5996b80870632ed11837d76d6933 Mon Sep 17 00:00:00 2001 From: Natalia Villegas Date: Sun, 16 Dec 2018 23:41:31 -0300 Subject: [PATCH] Fixing jenkisfile --- Jenkinsfile | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f1b6eb1b2..bd48c88f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,16 +24,25 @@ pipeline { stage('Sonar') { steps { - sh 'mvn sonar:sonar -Dsonar.projectKey=villegasnaty_spring-petclinic -Dsonar.organization=villegasnaty-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=5f3fd10f7702318ee919ea4d55890502510b2448' - } - } + sh 'mvn sonar:sonar -Dsonar.projectKey=villegasnaty_spring-petclinic -Dsonar.organization=villegasnaty-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=5f3fd10f7702318ee919ea4d55890502510b2448' + } + } + + stage('Build Container') { + steps { + echo 'Building..' + sh 'docker rmi --force "natyramone/pet-clinic"' + sh 'docker build -t pet-clinic .' + sh 'docker tag pet-clinic $DOCKER_USER/pet-clinic:latest' + } + } stage('Run local container') { agent any steps { - sh 'docker rm -f natyramone/pet-clinic:latest || true' - sh 'docker run -d -p 8081:8080 natyramone/pet-clinic:latest' + sh 'docker rm -f pet-clinic || true' + sh 'docker run -d -p 8081:8080 --name pet-clinic natyramone/pet-clinic:latest' } }