-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
74 lines (60 loc) · 1.92 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
pipeline {
agent any
stages {
stage('Prepare') {
steps {
echo 'Clonning Repository'
git(url: 'https://lab.ssafy.com/s06-bigdata-rec-sub2/S06P22A104.git', branch: 'develop', credentialsId: 'gitlab_id')
}
post {
success {
echo 'Successfully Pulled Repository'
}
}
}
stage('Parallel') {
parallel {
stage('Build backend') {
steps {
dir('/var/lib/jenkins/workspace/ssafit-backend/backend/spring'){
sh 'chmod +x gradlew'
sh './gradlew init'
sh './gradlew clean'
sh './gradlew build --exclude-task test'
sh 'docker build --tag=ssafit-backend .'
sh 'docker rm -f $(docker ps -a --filter "name=ssafit-backend" -q)'
sh 'docker run -d --name ssafit-backend -p 8081:8081 -v /var/webapps/upload/:/var/webapps/upload/ ssafit-backend:latest'
}
}
post {
success {
echo 'Successfully Building spring'
}
failure {
echo 'Failed Building backend'
}
}
}
stage('Build frontend'){
steps {
dir('/var/lib/jenkins/workspace/ssafit-backend/frontend'){
// sh 'sudo yarn install'
// sh 'sudo CI=false yarn build'
sh 'docker build --tag=ssafit-frontend .'
sh 'docker rm -f $(docker ps -a --filter "name=ssafit-frontend" -q)'
sh 'docker run -d --name ssafit-frontend -p 3000:3000 -v /var/webapps/upload/:/var/webapps/upload/ ssafit-frontend:latest'
}
}
post {
success {
echo 'Successfully Building react'
}
failure {
echo 'Failed Building frontend'
}
}
}
}
}
}
}