Skip to content

Commit

Permalink
added jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
LondheShubham153 committed Jan 22, 2023
1 parent b1d7f1c commit b26de1d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pipeline {
agent any

stages{
stage('Code'){
steps{
git url: 'https://github.com/LondheShubham153/node-todo-cicd.git', branch: 'master'
}
}
stage('Build'){
steps{
sh 'docker build . -t trainwithshubham/node-todo-test:latest'
}
}
stage('Push'){
steps{
withCredentials([usernamePassword(credentialsId: 'dockerHub', passwordVariable: 'dockerHubPassword', usernameVariable: 'dockerHubUser')]) {
sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPassword}"
sh 'docker push trainwithshubham/node-todo-test:latest'
}
}
}
stage('Test'){
steps{
echo "Testing the new build .."
}
}
stage('Deploy'){
steps{
sh "docker-compose down && docker-compose up -d"
}
}
}
}

0 comments on commit b26de1d

Please sign in to comment.