Created
August 23, 2015 22:07
-
-
Save jcsirot/4de001d280998f27aa82 to your computer and use it in GitHub Desktop.
Continuous delivery with Jenkins Workflow and Docker
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
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