-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
49 lines (49 loc) · 1.12 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
pipeline {
agent {
kubernetes {
label 'dbmigration-builder'
yaml """
apiVersion: v1
kind: Pod
spec:
containers: # list of containers that you want present for your build, you can define a default container in the Jenkinsfile
- name: docker
image: docker:18.06.1
command: ["tail", "-f", "/dev/null"]
imagePullPolicy: Always
volumeMounts:
- name: docker
mountPath: /var/run/docker.sock # We use the k8s host docker engine
volumes:
- name: docker
hostPath:
path: /var/run/docker.sock
"""
}
}
stages {
stage('docker login') {
steps {
container('jenkins-builder') {
sh 'docker login -u sunjayjeffrish --password !gP5tCAPbJYz=G_'
}
}
}
stage('build') {
steps {
container('jenkins-builder') {
dir("costAnalyser") {
sh "docker build . -f Dockerfile -t sunjayjeffrish/dbmigration:$GIT_COMMIT"
}
}
}
}
stage('push') {
steps {
container('jenkins-builder') {
sh "docker push"
}
}
}
}
}