forked from waldemarnt/node-docker-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
32 lines (32 loc) · 723 Bytes
/
Jenkinsfile
File metadata and controls
32 lines (32 loc) · 723 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
31
32
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
}
environment {
DOCKERHUB_CREDENTIALS = credentials('dockerhub')
IMAGE_NAME = 'node'
}
stages {
stage('Build') {
steps {
sh 'docker build -t ${env.node} .'
}
}
stage('Login') {
steps {
sh "echo \$DOCKERHUB_CREDENTIALS_PSW | docker login -u \$DOCKERHUB_CREDENTIALS_USR --password-stdin"
}
}
stage('Push') {
steps {
sh "docker push ${env.node}"
}
}
}
post {
always {
sh 'docker logout'
}
}
}