Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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"
}
}
}