-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsFile
77 lines (70 loc) · 2.02 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
pipeline {
agent any
stages {
stage('Build') {
steps {
bat 'mvn -B -DskipTests clean package'
}
}
stage('Build docker images') {
steps {
dir("Eureka") {
bat 'docker build -t eureka_server .'
}
dir("Zuul") {
bat 'docker build -t gateway .'
}
dir("UserService") {
bat 'docker build -t stock-market-user-service .'
}
dir("CompanyService") {
bat 'docker build -t stock-market-company-service .'
}
}
}
stage('Run eureka') {
steps {
script {
try {
bat 'docker container stop eureka_server'
bat 'docker container rm eureka_server'
} catch (err) {
echo err
}
}
bat 'docker run -d --name eureka_server -p 8761:8761 eureka_server'
}
}
stage('Run zuul') {
steps {
script {
try {
bat 'docker container stop gateway'
bat 'docker container rm gateway'
} catch (err) {
echo err
}
}
bat 'docker run -d --name gateway -p 8080:80 mod-zuul'
}
}
stage('Run user service') {
steps {
catchError {
bat 'docker container stop stock-market-user-service'
bat 'docker container rm stock-market-user-service'
}
bat 'docker run -d --name stock-market-user-service -p 8081:8081 mod-user-service'
}
}
stage('Run entit info service') {
steps {
catchError {
bat 'docker container stop stock-market-company-service'
bat 'docker container rm stock-market-company-service'
}
bat 'docker run -d --name stock-market-company-service -p 8082:8082 stock-market-company-service'
}
}
}
}