Jenkinsfile 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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. app = docker.build("strapi:latest")
  11. }
  12. stage('Test image') {
  13. /* Ideally, we would run a test framework against our image.
  14. * For this example, we're using a Volkswagen-type approach ;-) */
  15. app.inside {
  16. sh 'echo "Tests passed"'
  17. }
  18. }
  19. stage('Push image') {
  20. /* Finally, we'll push the image with two tags:
  21. * First, the incremental build number from Jenkins
  22. * Second, the 'latest' tag.
  23. * Pushing multiple tags is cheap, as all the layers are reused. */
  24. docker.withRegistry('https://container.kornblum.dev', 'container-kornblum-dev') {
  25. app.push("${env.BUILD_NUMBER}")
  26. app.push("latest")
  27. }
  28. }
  29. }