-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
65 lines (60 loc) · 2 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
pipeline {
agent any
tools {
go 'go 1.21.6'
}
stages {
stage('Checkout') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: '*/main']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[url: 'https://github.com/tkhv/GoRedis.git']]
])
}
}
stage('Clear Workspace') {
steps {
deleteDir()
}
}
stage('Build') {
steps {
sh 'git clone https://github.com/tkhv/GoRedis.git .'
sh 'go build'
}
}
stage('Deploy') {
steps {
sshPublisher(
continueOnError: false,
publishers: [
sshPublisherDesc(
configName: 'dockerhost',
transfers: [
sshTransfer(
execCommand: 'docker stop $(docker ps -a -q)',
execTimeout: 120000
),
sshTransfer(
sourceFiles: '*',
removePrefix: '',
remoteDirectory: '',
execCommand: 'docker build -t goredis .',
execTimeout: 120000
),
sshTransfer(
execCommand: 'docker run -d -p 6379:6379 goredis',
execTimeout: 120000
)
]
)
]
)
}
}
}
}