From 43336f64ae6f9d4515211cdc44ef16e6bff0c295 Mon Sep 17 00:00:00 2001 From: sandhya-subudhi-1998 <75432441+sandhya-subudhi-1998@users.noreply.github.com> Date: Fri, 26 Feb 2021 15:54:07 +0530 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index beba441..80ae2d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,33 @@ node { + def app - checkout scm + stage('Clone repository') { + /* Cloning the Repository to our Workspace */ - docker.withRegistry('https://registry.hub.docker.com', 'dockerHub') { + checkout scm + } + + stage('Build image') { + /* This builds the actual image */ - def customImage = docker.build("miltonc/dockerwebapp") + app = docker.build("sandhyasubudhi1998/nodeapp") + } + + stage('Test image') { + + app.inside { + echo "Tests passed" + } + } - /* Push the container to the custom Registry */ - customImage.push() + stage('Push image') { + /* + You would need to first register with DockerHub before you can push images to your account + */ + docker.withRegistry('https://registry.hub.docker.com', 'docker-hub') { + app.push("${env.BUILD_NUMBER}") + app.push("latest") + } + echo "Trying to Push Docker Build to DockerHub" } -} \ No newline at end of file +}