-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
80 lines (80 loc) · 3.05 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
75
76
77
78
79
80
pipeline {
agent any
environment {
imgServer="portus.odds.team/odds-installment/server:pipe-${BUILD_NUMBER}"
imgClient="portus.odds.team/odds-installment/client:pipe-${BUILD_NUMBER}"
registry="https://portus.odds.team"
appServer="odds-installment-server"
appClient="odds-installment-client"
type="service"
env="prod"
portServer="5000"
portClient="80"
}
options {
ansiColor('xterm')
}
stages{
stage('Build Imager Server And Push') {
steps {
dir ('server') {
sh "docker build -t ${imgServer} ."
}
}
}
stage('Push Image Server') {
steps {
withDockerRegistry(credentialsId: 'portus-jenkins', url: registry) {
sh "docker push ${imgServer}"
}
}
}
stage('Build Imager Client And Push') {
steps {
dir ('client') {
sh "docker build --build-arg environment=${env} -t ${imgClient} ."
}
}
}
stage('Push Image Client') {
steps {
withDockerRegistry(credentialsId: 'portus-jenkins', url: registry) {
sh "docker push ${imgClient}"
}
}
}
stage('Deploy Docker-compose and Apply Docker-compose'){
steps{
withDockerRegistry(credentialsId: 'portus-jenkins', url: registry) {
sh "cp $DOCKER_CONFIG/config.json ."
sshPublisher(
publishers: [
sshPublisherDesc(
configName: 'odds-installment',
transfers: [
sshTransfer(
cleanRemote: false,
excludes: '',
execCommand: "DOCKER_CONFIG=~ TAG=pipe-${BUILD_NUMBER} docker-compose up -d",
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '',
remoteDirectorySDF: false,
removePrefix: '',
sourceFiles: 'docker-compose.yaml, config.json'
)
],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: false
)
]
)
}
}
}
}
}