forked from QACTrainers/LBG-Python-API-Base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
32 lines (32 loc) · 1.05 KB
/
Jenkinsfile
File metadata and controls
32 lines (32 loc) · 1.05 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
pipeline {
agent any
environment {
PORT = "8000"
}
stages {
stage('Build') {
steps {
sh '''
docker build -t polthomson/lbg:${BUILD_NUMBER} --build-arg PORT=${PORT} .
docker tag polthomson/lbg:${BUILD_NUMBER} polthomson/lbg:latest
docker push polthomson/lbg:${BUILD_NUMBER}
docker push polthomson/lbg:latest
docker rmi polthomson/lbg:${BUILD_NUMBER}
docker rmi polthomson/lbg:latest
'''
}
}
stage('Deploy') {
steps {
sh '''
ssh jenkins@pault-deploy <<EOF
export PORT=${PORT}
export VERSION=${BUILD_NUMBER}
docker stop lbg-api && echo "stopped" || echo "not running"
docker rm lbg-api && echo "removed" || echo "already removed"
docker run -d -p 80:${PORT} -e PORT=${PORT} --name lbg-api polthomson/lbg:4
'''
}
}
}
}