Skip to content

Instantly share code, notes, and snippets.

@jcsirot
Created August 23, 2015 22:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcsirot/4de001d280998f27aa82 to your computer and use it in GitHub Desktop.
Save jcsirot/4de001d280998f27aa82 to your computer and use it in GitHub Desktop.
Continuous delivery with Jenkins Workflow and Docker
node {
env.JAVA_HOME="${tool 'JDK8'}"
stage 'Build'
git url: 'https://github.com/jcsirot/atmosphere-calculator.git'
def mvnHome = tool "maven-3.2.2"
sh "${mvnHome}/bin/mvn clean package"
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
stage 'Build Docker image'
def image = docker.build('jcsirot/atmo-calc:snapshot', '.')
stage 'Acceptance Tests'
image.withRun('-p 8181:8181') {c ->
sh "${mvnHome}/bin/mvn verify"
}
step([$class: 'JUnitResultArchiver', testResults: '**/target/failsafe-reports/TEST-*.xml'])
stage 'Push Docker image'
docker.withRegistry("https://registry.hub.docker.com", "docker-registry") {
image.push()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment