-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
67 lines (67 loc) · 2.11 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
pipeline {
agent any
stages {
stage('spring-build-deploy') {
steps {
script {
try {
mattermostSend (
color: "#ff7f00",
message: "spring-build-deploy 시작: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Link to build>)"
)
sh 'docker rm -f backend'
sh 'docker build -t dockerize-spring-boot-app ./backend'
sh 'docker run --name backend --network mysql -d -p 8080:8080 dockerize-spring-boot-app'
sh 'docker network connect front-back backend'
sh 'docker network connect redis-back backend'
} catch(e) {
currentBuild.result = "FAILURE"
} finally {
if(currentBuild.result == "FAILURE") {
mattermostSend (
color: "danger",
message: "spring-build-deploy 실패: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Link to build>)"
)
} else {
mattermostSend (
color: "good",
message: "spring-build-deploy 성공: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Link to build>)"
)
}
}
}
}
}
stage('vue-build-deploy') {
steps {
script {
try {
mattermostSend (
color: "#ff7f00",
message: "vue-build-deploy 시작: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Link to build>)"
)
sh 'docker rm -f frontend'
sh 'docker build -t dockerize-vuejs-app ./frontend'
sh 'docker container prune -f'
sh 'docker rmi $(docker images -f dangling=true -q)'
sh 'docker run --name frontend --network front-back -d -p 80:80 -p 443:443 -v /home/ubuntu/cert/:/etc/letsencrypt/ dockerize-vuejs-app'
} catch(e) {
currentBuild.result = "FAILURE"
} finally {
if(currentBuild.result == "FAILURE") {
mattermostSend (
color: "danger",
message: "vue-build-deploy 실패: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Link to build>)"
)
} else {
mattermostSend (
color: "good",
message: "vue-build-deploy 성공: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Link to build>)"
)
}
}
}
}
}
}
}