-
Notifications
You must be signed in to change notification settings - Fork 12
/
Jenkinsfile
61 lines (58 loc) · 1.35 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
52
53
54
55
56
57
58
59
60
61
pipeline {
agent none
stages {
stage('Install packages & Lint & run tests') {
agent {
dockerfile {
filename 'Dockerfile'
dir 'test'
}
}
steps {
sh 'npm install'
sh 'npm run lint'
sh 'npm run test'
}
}
stage('Release latest image on Docker hub') {
when { branch 'main' }
agent {
docker {
image 'docker:19.03.12-dind'
args '-e DOCKER_HOST=$DOCKER_HOST'
}
}
steps {
script {
def dockerImage = docker.build('linagora/esn-frontend-contacts', '--pull --no-cache .')
docker.withRegistry('', 'dockerHub') {
dockerImage.push('main')
}
}
}
post {
success {
echo 'Build OpenPaas front Docker image'
build wait: false, job: 'openpaas-front/main'
}
}
}
stage('Release tag on Docker hub') {
when { tag '*' }
agent {
docker {
image 'docker:19.03.12-dind'
args '-e DOCKER_HOST=$DOCKER_HOST'
}
}
steps {
script {
def dockerImage = docker.build('linagora/esn-frontend-contacts', '--pull --no-cache .')
docker.withRegistry('', 'dockerHub') {
dockerImage.push(env.TAG_NAME)
}
}
}
}
}
}