-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path--Jenkinsfile
51 lines (43 loc) · 1.42 KB
/
--Jenkinsfile
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/groovy
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage('Build artifacts') {
steps {
script {
// pulls .DEPS_IMAGE_NDAME with npm pkgs and creates simlink for node_modules from WORKDIR /www so that npm scripts can be executed
docker.image('jonlazarini/poll-app-deps:latest').inside {
sh 'ln -s /www/node_modules .'
sh 'npm run report:test'
sh 'npm run build'
// store build assets for next stage
stash includes: 'build/**/*', name: 'build'
}
}
}
}
stage('Build and Push Docker Image') {
steps {
script {
docker.withRegistry("${env.DOCKERHOST}",'nexusCredentials') {
// drop build assets
unstash 'build'
// builds .IMAGE_NAME with build/ assets and nginx to serve it
docker
// Dockerfile
.build("jonlazarini/poll-app", '--pull --no-cache .')
.push()
}
}
}
}
}
post {
always {
deleteDir()
}
}
}