Updated Jenkinsfile for Docker + Kubernetes
This commit is contained in:
parent
d08eeea7ae
commit
a06fc69fce
7
Jenkinsfile
vendored
7
Jenkinsfile
vendored
@ -4,7 +4,7 @@ pipeline {
|
|||||||
environment {
|
environment {
|
||||||
DOCKERHUB_USER = 'vipin2025devops'
|
DOCKERHUB_USER = 'vipin2025devops'
|
||||||
IMAGE_NAME = 'myapp'
|
IMAGE_NAME = 'myapp'
|
||||||
IMAGE_TAG = "latest"
|
IMAGE_TAG = 'latest'
|
||||||
K8S_DEPLOYMENT = 'k8s/deployment.yaml'
|
K8S_DEPLOYMENT = 'k8s/deployment.yaml'
|
||||||
K8S_SERVICE = 'k8s/service.yaml'
|
K8S_SERVICE = 'k8s/service.yaml'
|
||||||
}
|
}
|
||||||
@ -26,7 +26,10 @@ pipeline {
|
|||||||
|
|
||||||
stage('Push Image to Docker Hub') {
|
stage('Push Image to Docker Hub') {
|
||||||
steps {
|
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 """
|
powershell """
|
||||||
echo $env:DOCKER_PASS | docker login -u $env:DOCKER_USER --password-stdin
|
echo $env:DOCKER_PASS | docker login -u $env:DOCKER_USER --password-stdin
|
||||||
docker push ${DOCKERHUB_USER}/${IMAGE_NAME}:${IMAGE_TAG}
|
docker push ${DOCKERHUB_USER}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user