-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
36 lines (36 loc) · 713 Bytes
/
Jenkinsfile
File metadata and controls
36 lines (36 loc) · 713 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
pipeline {
agent any
environment {
DOCKERHUB_CREDENTIALS = credentials('dockerhub')
}
stages {
stage('Build') {
steps {
sh 'docker build -t omarmokhtar99/go-docker-app:latest .'
}
post {
failure {
error('Docker build failed!')
}
}
}
stage('Login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Push') {
steps {
sh 'docker push omarmokhtar99/go-docker-app'
}
}
}
post {
always {
sh 'docker logout'
}
success {
sh 'docker rmi omarmokhtar99/go-docker-app:latest'
}
}
}