Update Jenkinsfile

This commit is contained in:
senatorovv 2023-07-12 10:33:58 +04:00 committed by GitHub
parent 0a3a3ee79a
commit 115effa6d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

49
Jenkinsfile vendored
View file

@ -1,16 +1,49 @@
#!groovy
pipeline { pipeline {
agent none
stages { environment {
stage('Maven Install') { dockerimagename = "bravinwasike/react-app"
agent { dockerImage = ""
docker {
image 'maven:3.5.0'
} }
agent any
stages {
stage('Checkout Source') {
steps {
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{ steps{
sh 'mvn clean install' 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")
}
}
}
}
}