Skip to content

Instantly share code, notes, and snippets.

@ravikyada
Created October 24, 2023 08:35
Show Gist options
  • Save ravikyada/2fd9c74ea03e43f27a4b8dd7d4074888 to your computer and use it in GitHub Desktop.
Save ravikyada/2fd9c74ea03e43f27a4b8dd7d4074888 to your computer and use it in GitHub Desktop.
pipeline {
agent {
kubernetes {
yaml """
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: jnlp
workingDir: /home/jenkins
- name: kaniko
workingDir: /home/jenkins
image: gcr.io/kaniko-project/executor:debug
command:
- /busybox/cat
tty: true
volumeMounts:
- name: docker-config
mountPath: /kaniko/.docker/
- name: aws-secret
mountPath: /root/.aws/
restartPolicy: Never
volumes:
- name: docker-config
configMap:
name: docker-config
- name: aws-secret
secret:
secretName: aws-secret
"""
}
}
stages {
stage('Build DockerImage with Kaniko') {
environment {
PATH = "/busybox:/kaniko:$PATH"
}
steps {
container(name: 'kaniko', shell: '/busybox/sh') {
sh '''#!/busybox/sh
/kaniko/executor --context `pwd` --dockerfile Dockerfile --verbosity debug --destination 1234567890.dkr.ecr.ap-south-1.amazonaws.com/kanikotest:latestv1
'''
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment