-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
46 lines (44 loc) · 1.32 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
podTemplate(yaml: '''
apiVersion: v1
kind: Pod
metadata:
generateName: kaniko-
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
imagePullPolicy: IfNotPresent
args: ["--dockerfile=$(WORKSPACE)/Dockerfile",
"--context=$(WORKSPACE)",
"--destination=synoti21/famstory-backend:latest"]
volumeMounts:
- name: docker-config
mountPath: /kaniko/.docker
volumes:
- name: docker-config
secret:
secretName: regcred
''') {
node(POD_LABEL) {
stage('Checkout Code') {
checkout([
$class: 'GitSCM',
branches: [[name: '*/main']],
userRemoteConfigs: [[
url: 'https://github.com/Fam-Story/fam-Story_Backend',
credentialsId: 'jenkins-github'
]]
])
}
stage('Build and Push Docker Image') {
container('kaniko') {
sh """
/kaniko/executor \
--dockerfile=${WORKSPACE}/Dockerfile \
--context=${WORKSPACE} \
--destination=synoti21/famstory-backend:latest
"""
}
}
}
}