-
Notifications
You must be signed in to change notification settings - Fork 13
/
Jenkinsfile
executable file
·35 lines (35 loc) · 1.11 KB
/
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
35
pipeline {
agent none
stages {
stage('build') {
agent { docker { image 'docker' } }
steps {
sh 'docker build dockerfile/flask-api --tag demoyuw/flask-api:jenkins-package'
sh 'docker image ls'
}
when { branch 'master' }
}
stage('publish') {
agent { docker { image 'docker' } }
steps {
sh 'docker login -u demoyuw -p a0918101553'
sh 'docker push demoyuw/flask-api:jenkins-package'
}
when { branch 'master' }
}
stage('deploy') {
agent { docker { image 'docker' } }
steps {
sh 'docker stop flask-api || true && docker rm flask-api || true'
sh 'docker run -itd -p 10009:10009 --name flask-api demoyuw/flask-api:jenkins-package'
}
when { branch 'master' }
}
stage('unit-test') {
agent { docker { image 'docker' } }
steps {
sh 'docker exec -i flask-api python test.py'
}
}
}
}