mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-25 17:15:48 +00:00
Update Jenkinsfile
This commit is contained in:
parent
0a3a3ee79a
commit
115effa6d4
1 changed files with 42 additions and 9 deletions
51
Jenkinsfile
vendored
51
Jenkinsfile
vendored
|
@ -1,16 +1,49 @@
|
||||||
#!groovy
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent none
|
|
||||||
|
environment {
|
||||||
|
dockerimagename = "bravinwasike/react-app"
|
||||||
|
dockerImage = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
agent any
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Maven Install') {
|
|
||||||
agent {
|
stage('Checkout Source') {
|
||||||
docker {
|
|
||||||
image 'maven:3.5.0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
sh 'mvn clean install'
|
git 'https://github.com/Bravinsimiyu/jenkins-kubernetes-deployment.git'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Build image') {
|
||||||
|
steps{
|
||||||
|
script {
|
||||||
|
dockerImage = docker.build dockerimagename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Pushing Image') {
|
||||||
|
environment {
|
||||||
|
registryCredential = 'dockerhub-credentials'
|
||||||
|
}
|
||||||
|
steps{
|
||||||
|
script {
|
||||||
|
docker.withRegistry( 'https://registry.hub.docker.com', registryCredential ) {
|
||||||
|
dockerImage.push("latest")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploying React.js container to Kubernetes') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
kubernetesDeploy(configs: "deployment.yaml", "service.yaml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue