added spc

This commit is contained in:
sridhar 2023-09-06 17:08:36 +05:30
parent 7d7a91b258
commit 28911a7b95
2 changed files with 9 additions and 16 deletions

19
Jenkinsfile vendored
View file

@ -1,25 +1,18 @@
pipeline{ pipeline{
agent{label 'dotnet-7'} agent{label 'java-17'}
stages{ stages{
stage('VCS'){ stage('VCS'){
steps{ steps{
git credentialsId: 'GIT_HUB_CREDENTIALS', git credentialsId: 'GIT_HUB_CREDENTIALS',
url: 'https://github.com/Cloud-and-devops-notes/spring-petclinic-jenkins.git', url: 'https://github.com/Cloud-and-devops-notes/spring-petclinic-jenkins.git',
branch: 'tera' branch: 'main'
} }
} }
stage('artifact build'){ stage('artifact build'){
steps{ steps{
sh 'sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B53DC80D13EDEF05' sh 'docker build . -t sridhar006/spc-jenkins:${BUILD_ID}'
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' sh 'docker image list'
} }
} }
@ -33,9 +26,9 @@ pipeline{
} }
stage('docker push image '){ stage('docker push image '){
steps{ steps{
sh 'docker image build -t nop123 .' sh 'docker image build -t spc123 .'
sh 'docker image tag nop123 sridhar006/nopaugest:${BUILD_ID}' sh 'docker image tag spc123 sridhar006/spc-jenkins:${BUILD_ID}'
sh 'docker push sridhar006/nopaugest:${BUILD_ID}' sh 'docker push sridhar006/spc-jenkins:${BUILD_ID}'
} }
} }

View file

@ -25,9 +25,9 @@ spec:
spec: spec:
containers: containers:
- name: nop - name: nop
image: sridhar006/nopaugest:26 image: sridhar006/spc-jenkins:${BUILD_ID}
ports: ports:
- containerPort: 5000 - containerPort: 8080
--- ---
apiVersion: v1 apiVersion: v1
@ -42,5 +42,5 @@ spec:
- protocol: TCP - protocol: TCP
name: nop name: nop
port: 80 port: 80
targetPort: 5000 targetPort: 8080
type: LoadBalancer type: LoadBalancer