Skip to content

Instantly share code, notes, and snippets.

@pandeybk
Last active July 17, 2018 21:33
Show Gist options
  • Save pandeybk/eb226a2e636a6b138dfc636579d57419 to your computer and use it in GitHub Desktop.
Save pandeybk/eb226a2e636a6b138dfc636579d57419 to your computer and use it in GitHub Desktop.
Container-template-Jenkinsfile
podTemplate(label: 'kube-node', yaml: """
apiVersion: v1
kind: Pod
metadata:
name: docker
labels:
role: kube-node
spec:
hostNetwork: true
containers:
- name: docker
image: docker
command:
- cat
tty: true
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-volume
volumes:
- name: docker-volume
hostPath:
path: /var/run/docker.sock
""") {
node('kube-node') {
checkout scm
stage ('Create Bootkube Image') {
container ('docker') {
sh "apk add --no-cache make git"
sh "cd bootkube && make"
withDockerRegistry([credentialsId: 'quay-jenkins-ci', url: 'https://quay.io/goglides/demo']) {
sh "docker push quay.io/goglides/demo"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment