Skip to content

Instantly share code, notes, and snippets.

@AshishThakur
Last active April 8, 2022 07:54
Show Gist options
  • Save AshishThakur/e81af49ffc637612cb4fa3cd7253ab51 to your computer and use it in GitHub Desktop.
Save AshishThakur/e81af49ffc637612cb4fa3cd7253ab51 to your computer and use it in GitHub Desktop.
pipeline {
agent any
stages {
stage ('Checkout') {
steps {
script {
git credentialsId: 'github-creds', url: 'https://github.com/AshishThakur/java.git'
}
}
}
stage ('Build Image') {
steps {
script {
docker.withRegistry(BuildParams.protocol + "://" + BuildParams.registryUrl, BuildParams.credentials) {
dockerImage = BuildParams.dockerRegistryNamespace + "/" + BuildParams.serviceName + ":" + BuildParams.imageTag
sh "docker build ${dockerImage} ."
sh "docker tag ${dockerImage} ${BuildParams.registryUrl}/${dockerImage}"
}
}
}
stage ('Push Image') {
steps {
script {
sh "docker push ${BuildParams.registryUrl}/${dockerImage}"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment