forked from ravdy/nodejs-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
35 lines (33 loc) · 818 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 any
environment {
DOCKERHUB_CREDENTIALS = credentials('valaxy-dockerhub')
}
stages {
stage('SCM Checkout') {
steps{
git 'https://github.com/ravdy/nodejs-demo.git'
}
}
stage('Build docker image') {
steps {
sh 'docker build -t valaxy/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 valaxy/nodeapp:$BUILD_NUMBER'
}
}
}
post {
always {
sh 'docker logout'
}
}
}