Skip to content

Commit

Permalink
Update Jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
LondheShubham153 authored Nov 19, 2023
1 parent dffff53 commit 16931f2
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
pipeline {
agent any

stages{
stage("Code"){
stages {

stage("code"){
steps{
git url: "https://github.com/LondheShubham153/node-todo-cicd.git", branch: "master"
echo 'bhaiyya code clone ho gaya'
}
}
stage("Build & Test"){
stage("build and test"){
steps{
sh "docker build . -t node-app-test-new"
sh "docker build -t node-app-test-new ."
echo 'code build bhi ho gaya'
}
}
stage("Push to DockerHub"){
stage("scan image"){
steps{
echo 'image scanning ho gayi'
}
}
stage("push"){
steps{
withCredentials([usernamePassword(credentialsId:"dockerHub",passwordVariable:"dockerHubPass",usernameVariable:"dockerHubUser")]){
sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPass}"
sh "docker tag node-app-test-new ${env.dockerHubUser}/node-app-test-new:latest"
sh "docker push ${env.dockerHubUser}/node-app-test-new:latest"
sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPass}"
sh "docker tag node-app-test-new:latest ${env.dockerHubUser}/node-app-test-new:latest"
sh "docker push ${env.dockerHubUser}/node-app-test-new:latest"
echo 'image push ho gaya'
}
}
}
stage("Deploy"){
stage("deploy"){
steps{
sh "docker-compose down && docker-compose up -d"
echo 'deployment ho gayi'
}
}
}
Expand Down

0 comments on commit 16931f2

Please sign in to comment.