-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
35 lines (33 loc) · 860 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
28
29
30
31
32
33
34
pipeline {
agent { label 'java-label' }
environment {
DOCKERHUB_CREDENTIALS = credentials('SriniDockerCredentials')
}
stages {
stage('SCM Checkout') {
steps{
git 'https://github.com/ravdy/nodejs-demo.git'
}
}
stage('Build docker image') {
steps {
sh 'docker build -t srinivassambari/nodeapp:$BUILD_NUMBER .'
}
}
stage('login to dockerhub') {
steps{
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('push image') {
steps{
sh 'docker push srinivassambari/nodeapp:$BUILD_NUMBER'
}
}
}
post {
always {
sh 'docker logout'
}
}
}