-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathJenkinsfile
More file actions
30 lines (30 loc) · 740 Bytes
/
Jenkinsfile
File metadata and controls
30 lines (30 loc) · 740 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
pipeline {
agent any
stages{
stage('Build Image'){
steps{
sh 'docker build -t gcr.io/lbg-210222/api-piers:latest -t gcr.io/lbg-210222/api-piers:build-$BUILD_NUMBER .'
}
}
stage('Push GCR'){
steps{
sh 'docker push gcr.io/lbg-210222/api-piers:build-$BUILD_NUMBER'
sh 'docker push gcr.io/lbg-210222/api-piers:latest'
}
}
stage('Reapply '){
steps{
sh '''kubectl apply -f ./kubernetes/nginx.yaml
kubectl apply -f ./kubernetes/api-deployment.yml
kubectl rollout restart deployment/api
'''
}
}
stage('Cleanup'){
steps{
sh 'docker rmi gcr.io/lbg-210222/api-piers:latest'
sh 'docker rmi gcr.io/lbg-210222/api-piers:build-$BUILD_NUMBER'
}
}
}
}