forked from srinivasulu0514/dockerdemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
27 lines (26 loc) · 832 Bytes
/
Jenkinsfile
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
pipeline {
agent any
stages{
stage ('Checkout GitHub repo') {
steps {
checkout scmGit(branches: [[name: '*/master']], extensions:[], userRemoteConfigs: [[url:"https://github.com/srinivasulu0514/dockerdemo"]])
}
}
stage("Build and Tag Docker Image") {
steps {
script {
sh 'docker build. -t hellodocker'
sh 'docker tag hellodocker srinivasulu0514/dockervasu)'
}
}
}
stage ("Push the Docker Image to DockerHUb"){
steps {
script {
withCredentials([string(credentialsId:'docker_hub',variable:'docker_hub')]){
sh 'docker login -u [email protected] -p ${docker_hub}'
}
sh 'docker push srinivasulu0514/dockervasu'
}
}
}