Created
June 25, 2019 00:07
-
-
Save egeneralov/8d52e799bb9f28b42b4eb721cf952463 to your computer and use it in GitHub Desktop.
Jenkinsfile examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example Jenkinsfile for build docker images. | |
Just place inside VCS and use multibranch project. | |
*/ | |
node('master') { | |
checkout scm | |
stage("build") { | |
/* build it */ | |
def customImage = docker.build( | |
"my-image:${env.BUILD_ID}", | |
"./Dockerfile.non-standart" | |
) | |
} | |
stage("test") { | |
/* test it */ | |
customImage.inside { | |
sh 'make test' | |
} | |
} | |
stage("test") { | |
/* use registry with plain auth, like "gitlab registry"/"docker hub" */ | |
docker.withRegistry('https://registry.example.com', 'credentials-id') { | |
/* push it */ | |
customImage.push() | |
/* and push with custom tag */ | |
customImage.push('latest') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment