-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJenkinsfile.app
More file actions
81 lines (77 loc) · 2.72 KB
/
Jenkinsfile.app
File metadata and controls
81 lines (77 loc) · 2.72 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
pipeline {
agent any
environment {
COMPOSE_FILE = 'docker-compose.app.yml'
}
stages {
stage('Checkout') {
steps {
echo '코드 체크아웃 중...'
checkout scm
}
}
stage('Build') {
steps {
echo 'Rebirth 모듈 빌드 (테스트 생략)'
// rebirth 모듈 빌드
dir('BE/rebirth') {
sh 'chmod +x gradlew'
sh './gradlew clean build -x test'
}
echo 'Cardissuer 모듈 빌드 (테스트 생략)'
// cardissuer 모듈 빌드
dir('BE/cardissuer') {
sh 'chmod +x gradlew'
sh './gradlew clean build -x test'
}
echo 'Bank 모듈 빌드 (테스트 생략)'
// bank 모듈 빌드
dir('BE/bank') {
sh 'chmod +x gradlew'
sh './gradlew clean build -x test'
}
}
}
stage('Docker Image Build') {
steps {
echo 'Docker 이미지 빌드 중...'
// rebirth 이미지 빌드
dir('BE/rebirth') {
sh 'docker build -t rebirth-image .'
}
// cardissuer 이미지 빌드
dir('BE/cardissuer') {
sh 'docker build -t cardissuer-image .'
}
// bank 이미지 빌드
dir('BE/bank') {
sh 'docker build -t bank-image .'
}
}
}
stage('Deploy') {
steps {
echo '애플리케이션 서비스 배포 중...'
echo '기존 애플리케이션 컨테이너 종료 및 제거...'
// 남아 있는 컨테이너 강제 제거 (이름 충돌 방지)
sh '''
docker ps -a --filter "name=-app" --format "{{.Names}}" | xargs -r docker rm -f || true
'''
// 네트워크나 orphan 컨테이너 포함 제거
sh 'docker-compose -f docker-compose.app.yml down --remove-orphans || true'
echo '변경된 설정으로 컨테이너 생성...'
sh 'docker-compose -f docker-compose.app.yml up -d'
echo 'nginx reload 실행...'
sh 'docker exec -i nginx_proxy nginx -s reload'
}
}
}
post {
success {
echo '배포가 성공적으로 완료되었습니다.'
}
failure {
echo '배포에 실패하였습니다. 로그를 확인하세요.'
}
}
}