Created
October 24, 2023 08:35
-
-
Save ravikyada/2fd9c74ea03e43f27a4b8dd7d4074888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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