diff --git a/Jenkinsfile b/Jenkinsfile index 34ff90831..7eccd1a77 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,25 +1,18 @@ pipeline{ - agent{label 'dotnet-7'} + agent{label 'java-17'} stages{ stage('VCS'){ steps{ git credentialsId: 'GIT_HUB_CREDENTIALS', url: 'https://github.com/Cloud-and-devops-notes/spring-petclinic-jenkins.git', - branch: 'tera' + branch: 'main' } } 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 build . -t sridhar006/spc-jenkins:${BUILD_ID}' sh 'docker image list' } } @@ -33,9 +26,9 @@ pipeline{ } 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}' + sh 'docker image build -t spc123 .' + sh 'docker image tag spc123 sridhar006/spc-jenkins:${BUILD_ID}' + sh 'docker push sridhar006/spc-jenkins:${BUILD_ID}' } } diff --git a/deployement.yaml b/deployement.yaml index 9650d86c8..6cd8d3ee3 100644 --- a/deployement.yaml +++ b/deployement.yaml @@ -25,9 +25,9 @@ spec: spec: containers: - name: nop - image: sridhar006/nopaugest:26 + image: sridhar006/spc-jenkins:${BUILD_ID} ports: - - containerPort: 5000 + - containerPort: 8080 --- apiVersion: v1 @@ -42,5 +42,5 @@ spec: - protocol: TCP name: nop port: 80 - targetPort: 5000 + targetPort: 8080 type: LoadBalancer \ No newline at end of file