Jenkinsfile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. node {
  2. def app
  3. stage('Clone repository') {
  4. /* Let's make sure we have the repository cloned to our workspace */
  5. checkout scm
  6. }
  7. stage('Build image') {
  8. /* This builds the actual image; synonymous to
  9. * docker build on the command line */
  10. agent {
  11. app = docker.build("hochzeit:latest")
  12. }
  13. }
  14. stage('Test image') {
  15. /* Ideally, we would run a test framework against our image.
  16. * For this example, we're using a Volkswagen-type approach ;-) */
  17. agent {
  18. app.inside {
  19. sh 'echo "Tests passed"'
  20. }
  21. }
  22. }
  23. stage('Push image') {
  24. /* Finally, we'll push the image with two tags:
  25. * First, the incremental build number from Jenkins
  26. * Second, the 'latest' tag.
  27. * Pushing multiple tags is cheap, as all the layers are reused. */
  28. agent {
  29. docker.withRegistry('https://container.kornbum.dev', 'container-kornblum-dev') {
  30. app.push("${env.BUILD_NUMBER}")
  31. app.push("latest")
  32. }
  33. }
  34. }
  35. }