52 lines
1.2 KiB
Groovy
52 lines
1.2 KiB
Groovy
pipeline {
|
|
agent {
|
|
kubernetes {
|
|
yaml '''
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: docker
|
|
labels:
|
|
name: docker
|
|
spec:
|
|
containers:
|
|
- name: kaniko
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
imagePullPolicy: Always
|
|
command:
|
|
- sleep
|
|
args:
|
|
- 9999999
|
|
- name: dind
|
|
image: docker:24.0.0-rc.1-dind
|
|
securityContext:
|
|
privileged: true
|
|
volumeMounts:
|
|
- mountPath: "/home/jenkins/agent"
|
|
name: "workspace-volume"
|
|
readOnly: false
|
|
'''
|
|
retries 2
|
|
}
|
|
}
|
|
stages {
|
|
stage('Build Docker image') {
|
|
steps {
|
|
container(name: 'kaniko', shell: '/busybox/sh') {
|
|
sh '''#!/busybox/sh
|
|
|
|
/kaniko/executor --dockerfile `pwd`/Dockerfile --context `pwd` --destination="andreas/rsyncd:latest"
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
stage('Tag Docker image') {
|
|
steps {
|
|
container('kaniko') {
|
|
sh 'docker images'
|
|
sh 'ls -la'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |