-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
34 lines (33 loc) · 1.17 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
pipeline {
agent any
stages {
stage("Code"){
steps{
git url: "https://github.com/Dark-Kernel/node-api.git", branch: "master"
}
}
stage("Build & test"){
steps{
sh "docker build . -t node-api"
}
}
stage("Push to repo"){
steps{
withCredentials([usernamePassword(credentialsId:"dockerhubid", passwordVariable:"dockerhubidPass", usernameVariable:"dockerhubidUser")]){
sh "docker login -u ${env.dockerhubidUser} -p ${env.dockerhubidPass}"
sh "docker tag node-api ${env.dockerhubidUser}/node-api:latest"
sh "docker push ${env.dockerhubidUser}/node-api:latest"
}
echo "Pushed to docker hub registry"
}
}
stage("Deploy"){
steps{
sh "kubectl apply -f Kubernetes/deployment.yaml"
sh "kubectl apply -f Kubernetes/service.yaml"
// sh "docker-compose down && docker-compose up -d"
echo "Deployed via kubernetes"
}
}
}
}