-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
43 lines (37 loc) · 1.03 KB
/
Jenkinsfile
File metadata and controls
43 lines (37 loc) · 1.03 KB
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
pipeline {
agent any
stages {
stage('Stop All Conatiners') {
steps {
sh 'docker stop pypipe'
}
}
stage('Checkout') {
steps {
git branch: 'main', url: 'https://github.com/sanjay2334/devops-learning'
}
}
stage('Test Run') {
steps {
sh 'python3 hello.py'
}
}
stage('Build') {
steps {
sh 'docker build -t sanjay2334/devops-learning:'+"${BUILD_ID}"+' .'
}
}
stage('Build Test Run') {
steps {
sh 'docker run sanjay2334/devops-learning:'+"${BUILD_ID}"
}
}
stage('Deploy to docker hub') {
steps {
withDockerRegistry([ credentialsId: "docker-hub-login", url: ""]) {
sh 'docker push sanjay2334/devops-learning:'+"${BUILD_ID}"
}
}
}
}
}