-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
84 lines (73 loc) · 2.47 KB
/
Jenkinsfile
File metadata and controls
84 lines (73 loc) · 2.47 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
pipeline {
agent any
stages {
stage('BE Build') {
steps {
sh 'chmod -R 777 .'
dir('BE'){
sh './gradlew clean build'
}
}
}
stage('Docker Compose Down') {
steps {
echo 'Stopping and removing the Docker container named inmind-server...'
sh '''
docker rm -f inmind-server || true
'''
}
}
stage('Docker Compose Up') {
steps {
echo 'Deploying Docker containers...'
sh 'docker-compose up --build -d'
}
}
// stage('Check Dump File') {
// steps {
// echo 'Checking if Dump.sql file exists...'
// sh 'ls -la $WORKSPACE'
// sh 'ls -la $WORKSPACE/mysql'
// }
// }
// stage('Restore MySQL Dump') {
// steps {
// echo 'Restoring MySQL dump file to the MySQL container...'
// sh '''
// # 덤프 파일을 복사하여 컨테이너 내부로 이동
// docker cp $WORKSPACE/mysql/Dump.sql openvidu-mysql-1:/Dump.sql
// # 덤프 파일을 MySQL 데이터베이스로 복원
// docker exec openvidu-mysql-1 bash -c "mysql -u root -p1234 inmind < Dump.sql"
// # 덤프 파일 삭제 (선택 사항)
// docker exec openvidu-mysql-1 rm Dump.sql
// '''
// }
// }
stage('Docker Image Build'){
steps{
dir('FE'){
sh 'docker build -t inmind-nginx-image .'
}
}
}
stage('Docker Stop & Remove') {
steps {
echo 'Stopping and removing the Docker container named inmind-nginx...'
dir('FE') {
sh '''
docker stop inmind-nginx || true
docker rm -v inmind-nginx || true
'''
}
}
}
stage('Docker Run') {
steps {
dir('FE') {
echo 'Deploying Docker containers...'
sh 'docker run -d --network host --name inmind-nginx inmind-nginx-image'
}
}
}
}
}