-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
153 lines (152 loc) · 3.97 KB
/
Jenkinsfile
File metadata and controls
153 lines (152 loc) · 3.97 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
pipeline
{
agent any
// tools {
// gradle 'gradle 7.6.1'
// }
environment {
PROJECT = 'ae-book'
APP_SPRING_API = 'backend'
APP_AI_API = 'ai'
APP_BATCH = 'batch'
}
stages {
//===================================== Environment =====================================
// docker-compose 대신 k8s 사용 고려 중
// stage('environment') {
// when {
// changeset "env-config/**/*"
// }
// steps {
// echo 'Environment Settings Start'
// sh 'docker-compose -f env-config/docker-compose-env.yml down'
// sh 'docker-compose -f env-config/docker-compose-env.yml up -d'
// echo 'Environment Settings End'
// }
// }
//===================================== Front app =====================================
stage('build-front') {
when {
changeset "frontend/**/*"
}
steps {
echo 'Build Start Front App'
sh 'docker build -t front-vue-img frontend/. --no-cache'
echo 'Build End Front App'
}
}
// stage('deploy-front') {
// when {
// changeset "frontend/**/*"
// }
// steps {
// echo 'Deploy Start Front App'
// sh '''
// if (docker ps | grep "front-vue"); then docker stop front-vue;
// fi
// docker run -it -d --rm -p 3000:3000 --name front-vue --network env-config_ae-book_network front-vue-img
// '''
// echo 'Deploy End Front App'
// }
// }
//===================================== Spring API =====================================
stage('build-spring-api') {
when {
anyOf {
changeset "backend/**/*"
}
}
steps {
echo 'Build Start backend spring'
sh '''
chmod +x backend/gradlew
backend/gradlew -p backend cleanQuerydslSourceDir
backend/gradlew -p backend build -x test
docker build -t back-spring-img backend/. --no-cache
'''
echo 'Build End backend spring'
}
}
// stage('deploy-spring-api') {
// when {
// anyOf {
// changeset "backend/**/*"
// }
// }
// steps {
// echo 'Deploy Start "${APP_SPRING_API}"'
// sh '''
// if (docker ps | grep "back-spring"); then docker stop back-spring;
// fi
// docker run -it -d --rm -p 8082:8082 --name back-spring --network env-config_ae-book_network back-spring-img
// '''
// echo 'Deploy End "${APP_SPRING_API}"'
// }
// }
//===================================== Batch =====================================
stage('build-batch') {
when {
anyOf {
changeset "batch/**/*"
}
}
steps {
echo 'Build Start batch'
sh '''
chmod +x batch/gradlew
batch/gradlew -p batch build -x test
docker build -t back-batch-img batch/. --no-cache
'''
echo 'Build End batch'
}
}
// batch는 build 될 때마다 데이터가 들어가기 때문에 변경사항있다고 run하는건 아닌 듯...
// stage('deploy-batch-api') {
// when {
// anyOf {
// changeset "batch/**/*"
// }
// }
// steps {
// echo 'Deploy Start "${APP_BATCH}"'
// sh '''
// if (docker ps | grep "back-batch"); then docker stop back-batch;
// fi
// docker run -it -d --rm -p 8084:8082 --name back-batch --network env-config_ae-book_network back-batch-img
// '''
// echo 'Deploy End "${APP_BATCH}"'
// }
// }
//===================================== AI =====================================
stage('build-ai-api') {
when {
anyOf {
changeset "ai/**/*"
}
}
steps {
echo 'Build Start backend fastAPI'
sh '''
docker build -t back-fast-img ai/. --no-cache
'''
echo 'Build End backend fastAPI'
}
}
// stage('deploy-ai-api') {
// when {
// anyOf {
// changeset "ai/**/*"
// }
// }
// steps {
// echo 'Deploy Start "${APP_SPRING_API}"'
// sh '''
// if (docker ps | grep "back-fast"); then docker stop back-fast;
// fi
// docker run -it -d --rm -p 8000:8000 --name back-fast --network env-config_ae-book_network back-fast-img
// '''
// echo 'Deploy End "${APP_SPRING_API}"'
// }
// }
}
}