Jenkinsfile 853 Bytes
Newer Older
CANLERS Julien's avatar
CANLERS Julien committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
node {
  def app1

  stage('Cleaning up working dir') {
    step([$class: 'WsCleanup'])
  }

  stage('Clone repository') {
    /* Let's make sure we have the repository cloned to our workspace */
    checkout scm
  }

  stage('build') {
    stage('Build image application:latest') {
      /* This builds the actual image; synonymous to
      * docker build on the command line */
      app1 = docker.build( "http://localhost:8081/repository/docker-private/debian:1")
    }
  }

  stage('Push image') {
    /* Finally, we'll push the image with two tags:
    * First, the incremental build number from Jenkins
    * Second, the 'latest' tag.
    * Pushing multiple tags is cheap, as all the layers are reused. */
    docker.withRegistry('http://localhost:8081/repository/docker-private/', 'nexus-user-credentials') {
      app1.push("latest")
    }
  }
}