-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
33 lines (31 loc) · 1.07 KB
/
Jenkinsfile
File metadata and controls
33 lines (31 loc) · 1.07 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
pipeline{
agent{
label "k8s"
}
stages{
stage("Git Clone"){
steps{
git 'https://github.com/Shudhoo/capstone-project-2.1.git'
}
}
stage("Build & Push Docker Image"){
steps{
withDockerRegistry(credentialsId: 'docker-cred', url: 'https://index.docker.io/v1/'){
dir('/home/ubuntu/jenkins/workspace/Capstone-Project-2-Pipeline') {
sh '''sudo docker build --file Dockerfile --tag shudhodhan/mycapstone:$BUILD_NUMBER .
sudo docker push shudhodhan/mycapstone:$BUILD_NUMBER'''
}
}
}
}
stage("Deployment of Application"){
steps{
dir('/home/ubuntu/jenkins/workspace/Capstone-Project-2-Pipeline') {
sh "sed -i 's|REPLACE_TAG|$BUILD_NUMBER|g' deployment.yml"
sh 'kubectl apply -f deployment.yml'
sh 'kubectl apply -f service.yml'
}
}
}
}
}