Updated Jenkinsfile for Docker + Kubernetes

This commit is contained in:
VIPIN 2025-09-12 12:09:09 +05:30
parent d08eeea7ae
commit a06fc69fce

7
Jenkinsfile vendored
View File

@ -4,7 +4,7 @@ pipeline {
environment {
DOCKERHUB_USER = 'vipin2025devops'
IMAGE_NAME = 'myapp'
IMAGE_TAG = "latest"
IMAGE_TAG = 'latest'
K8S_DEPLOYMENT = 'k8s/deployment.yaml'
K8S_SERVICE = 'k8s/service.yaml'
}
@ -26,7 +26,10 @@ pipeline {
stage('Push Image to Docker Hub') {
steps {
withCredentials([usernamePassword(credentialsId: 'docker-hub-credentials', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
withCredentials([usernamePassword(
credentialsId: 'dockerhub-creds',
usernameVariable: 'DOCKER_USER',
passwordVariable: 'DOCKER_PASS')]) {
powershell """
echo $env:DOCKER_PASS | docker login -u $env:DOCKER_USER --password-stdin
docker push ${DOCKERHUB_USER}/${IMAGE_NAME}:${IMAGE_TAG}