forked from every-coding/EveryCoding_Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkinsfile
52 lines (43 loc) · 1.79 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
/* pipeline 변수 설정 */
def app
node {
// gitlab으로부터 소스 다운하는 stage
stage('Checkout') {
checkout scm
}
// mvn 툴 선언하는 stage, 필자의 경우 maven 3.6.0을 사용중
stage('Ready'){
sh "echo 'Ready to build'"
}
//dockerfile기반 빌드하는 stage ,git소스 root에 dockerfile이 있어야한다
stage('Build image'){
app = docker.build("harbor.cu.ac.kr/dcucoding/ec_frontend")
}
//dockerfile기반 빌드하는 stage ,git소스 root에 dockerfile이 있어야한다
stage('Build image'){
app = docker.build("harbor.cu.ac.kr/dcucoding/ec_frontend")
sh """
docker run --name sample -d -u root harbor.cu.ac.kr/dcucoding/ec_frontend
docker cp sample:/oj_frontend/dist .
docker rm -f sample
"""
sh "ls -al"
sh "ls -al dist"
sh '''
tar czvf latest.tar.gz -C dist .
cp latest.tar.gz build_${BUILD_NUMBER}.tar.gz
pwd
ls -al
'''
}
stage("Publish on SSH") {
sshPublisher(publishers: [sshPublisherDesc(configName: 'snslab_ssh', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/static_files/everycoding', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '*.tar.gz')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)])
}
//stage('Kubernetes deploy') {
// sh "kubectl delete -f /services/dcucoding/ec-frontend_con.yaml -n dcucoding"
// sh "kubectl apply -f /services/dcucoding/ec-frontend_con.yaml -n dcucoding"
//}
stage('Complete') {
sh "echo 'The end'"
}
}