-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
56 lines (54 loc) · 1.52 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
pipeline {
agent { label 'RuVDS' }
stages {
stage('docker version') {
steps {
sh "echo $USER"
sh 'docker version'
}
}
stage('Delete before build start') {
steps {
deleteDir()
}
}
stage('Checkout') {
steps {
git branch: 'main',
url: 'https://github.com/isakimov/devops-ruvds.git'
}
}
stage('Test') {
steps {
sh 'pwd'
sh 'ls -la'
}
}
stage('Build docker image') {
steps {
sh 'docker build -t isakimov/devops-info:1.0 .'
}
}
stage('Push docker images to DockerHub') {
steps {
withDockerRegistry(credentialsId: 'dockerhub-cred-prod', url: 'https://index.docker.io/v1/') {
sh '''
docker push isakimov/devops-info:1.0
'''
}
}
}
stage('Delete docker image locally') {
steps {
sh 'docker rmi isakimov/devops-info:1.0'
}
}
stage('Deploy App') {
steps {
script {
kubernetesDeploy(configs: "devops-info-deployment.yaml", kubeconfigId: "RuVDS_config")
}
}
}
}
}