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 +}