Build stage

This commit is contained in:
Milan Petrovic 2025-06-11 13:59:20 +02:00
parent fda33aa261
commit 59743758cd

16
Jenkinsfile vendored
View file

@ -27,9 +27,19 @@ pipeline {
steps { steps {
script { script {
def branch = env.BRANCH_NAME def branch = env.BRANCH_NAME
sh """ def dockerRepo = (branch == 'main') ? 'main' : 'mr'
echo $BRANCH_NAME def imageTag = "${DOCKER_HUB_USER}/${repo}:${GIT_COMMIT_SHORT}"
"""
withCredentials([usernamePassword(
credentialsId: DOCKERHUB_CREDES,
usernameVariable: 'DOCKER_USER',
passwordVariable: 'DOCKER_PASS'
)]) {
echo "Logging in to Docker Hub..."
sh "echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin"
echo "Pushing Docker image to ${imageTag}"
sh "docker push ${imageTag}"
}
} }
} }
} }