forked from rahulshettyacademy/MavenHelloWorld
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
49 lines (34 loc) · 712 Bytes
/
Jenkinsfile
File metadata and controls
49 lines (34 loc) · 712 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pipeline{
agent any
//create dockerhub credential in github with TOKEN
environment {
DOCKERHUB_CREDENTIALS=credentials('dockerhub')
}
stages {
stage('gitclone') {
steps {
git 'https://github.com/theitern/DevopsBasics.git'
}
}
stage('Build') {
steps {
sh 'docker build -t akinaregbesola/class_app:${BUILD_NUMBER} .'
}
}
stage('Login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login --username akinaregbesola --password-stdin'
}
}
stage('Push') {
steps {
sh 'docker push akinaregbesola/class_app:${BUILD_NUMBER}'
}
}
}
post {
always {
sh 'docker logout'
}
}
}