-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
38 lines (34 loc) · 1010 Bytes
/
Jenkinsfile
File metadata and controls
38 lines (34 loc) · 1010 Bytes
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
pipeline {
agent any
triggers {
pollSCM('H/5 * * * *') // Poll every 5 minutes
}
stages {
stage('Prepare') {
steps {
script {
// Clone the main repo using the deployment key
sshagent(['swagger-jenkins-deploy-key']) {
sh 'git clone git@github.com:Jayssgss/swagger-jenkins.git'
}
}
}
}
stage('Build Docker Image') {
steps {
dir('swagger-jenkins') {
sh 'docker build -t swagger-jenkins:latest .'
}
}
}
stage('Deploy') {
steps {
sh '''
docker stop swagger-jenkins || true
docker rm swagger-jenkins || true
docker run -d --name swagger-jenkins -p 8080:8080 swagger-jenkins:latest
'''
}
}
}
}