-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeline_dockerhubpush
More file actions
30 lines (29 loc) · 982 Bytes
/
Copy pathpipeline_dockerhubpush
File metadata and controls
30 lines (29 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pipeline {
agent { label 'dev-agent' }
stages{
stage('Code'){
steps{
git url: 'https://github.com/gsbarure/node-todo-cicd.git', branch: 'master'
}
}
stage('Build and Test'){
steps{
sh 'docker build . -t gajananbarure/node-todo-app-cicd:latest'
}
}
stage('Login and Push Image'){
steps {
echo 'login in docker hub and pushing'
withCredentials([usernamePassword(credentialsId:'dockerhub', passwordVariable:'dockerhubpassword', usernameVariable:'dockerhubuser')]) {
sh "docker login -u ${env.dockerhubuser} -p ${env.dockerhubPassword}"
sh 'docker push gajananbarure/node-todo-app-cicd:latest'
}
}
}
stage('Deploy'){
steps{
sh "docker-compose down && docker-compose up -d"
}
}
}
}