mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 16:25:49 +00:00
added spc
This commit is contained in:
parent
4926e29270
commit
7d7a91b258
2 changed files with 96 additions and 0 deletions
50
Jenkinsfile
vendored
Normal file
50
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
pipeline{
|
||||
agent{label 'dotnet-7'}
|
||||
stages{
|
||||
stage('VCS'){
|
||||
steps{
|
||||
git credentialsId: 'GIT_HUB_CREDENTIALS',
|
||||
url: 'https://github.com/Cloud-and-devops-notes/spring-petclinic-jenkins.git',
|
||||
branch: 'tera'
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
stage('artifact build'){
|
||||
steps{
|
||||
sh 'sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B53DC80D13EDEF05'
|
||||
sh 'sudo apt upgrade dotnet-sdk-7.0 -y'
|
||||
sh 'dotnet restore src/NopCommerce.sln'
|
||||
sh 'dotnet build -c Release src/NopCommerce.sln'
|
||||
sh 'dotnet publish -c Release src/Presentation/Nop.Web/Nop.Web.csproj -o publish'
|
||||
sh 'sudo apt install zip -y'
|
||||
sh 'zip -r nopCommerce.zip publish'
|
||||
archive '**/nopCommerce.zip'
|
||||
sh 'docker image list'
|
||||
}
|
||||
}
|
||||
|
||||
stage('docker login'){
|
||||
steps{
|
||||
withCredentials([string(credentialsId: 'DOCKER_HUB_PASSWORD',variable: 'PASSWORD')]) {
|
||||
sh 'docker login -u sridhar006 -p $PASSWORD'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('docker push image '){
|
||||
steps{
|
||||
sh 'docker image build -t nop123 .'
|
||||
sh 'docker image tag nop123 sridhar006/nopaugest:${BUILD_ID}'
|
||||
sh 'docker push sridhar006/nopaugest:${BUILD_ID}'
|
||||
|
||||
}
|
||||
}
|
||||
stage("kubernetes deployment"){
|
||||
steps{
|
||||
sh 'kubectl apply -f deployment.yaml'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
46
deployement.yaml
Normal file
46
deployement.yaml
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nop
|
||||
labels:
|
||||
app: nop
|
||||
spec:
|
||||
minReadySeconds: 5
|
||||
replicas: 4
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nop
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nop
|
||||
name: nop
|
||||
spec:
|
||||
containers:
|
||||
- name: nop
|
||||
image: sridhar006/nopaugest:26
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: nop
|
||||
spec:
|
||||
selector:
|
||||
app: nop
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- protocol: TCP
|
||||
name: nop
|
||||
port: 80
|
||||
targetPort: 5000
|
||||
type: LoadBalancer
|
Loading…
Reference in a new issue