-
Notifications
You must be signed in to change notification settings - Fork 7
/
Jenkinsfile
52 lines (45 loc) · 1.49 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
pipeline {
agent any
environment{
dockercredentials=credentials('dockerhubid')
}
stages {
stage('Build & Package') {
steps {
sh 'mvn clean package -DskipTests'
}
}
stage('Unit test') {
steps {
sh 'mvn test'
}
}
stage('stop and delete last version') {
steps {
sh 'docker compose down'
//sh 'docker rmi zencaisse || echo "success : image delete"'
sh 'docker rmi docker rmi $(docker images | grep zencaisse) --force || echo "success : image delete"'
}
}
stage('Build image') {
steps {
sh 'docker build -t zencaisse:$BUILD_NUMBER . '
}
}
// stage('Push image') {
// steps {
// sh 'echo $dockercredentials_PSW | docker login -u $dockercredentials_USR --password-stdin '
// sh 'docker image tag zencaisse:$BUILD_NUMBER lugar2020/zencaisse:$BUILD_NUMBER'
// sh 'docker image push lugar2020/zencaisse:$BUILD_NUMBER'
// }
// }
stage('Local deployment') {
steps {
sh ''' final_tag=$(echo $BUILD_NUMBER | tr -d ' ')
sed -i "s/docker_tag/$final_tag/g" docker-compose.yml
'''
sh 'docker compose up -d'
}
}
}
}