A jenkins-slave customized docker image 🐳
The goal is to build a useful image to serve as the base for Jenkins slaves. Thus, containing goods such as java, node, git, maven and python. And, on top of that it provides kubectl and helm binaries for working with a Kubernetes cluster.
$ docker pull sergiomartins8/jenkins-slave-base:latest
podTemplate(label: 'jenkins-slave-base-pod', serviceAccount: 'jenkins', containers: [
containerTemplate(
name: 'base',
image: 'sergiomartins8/jenkins-slave-base:latest',
ttyEnabled: true,
command: 'cat'
)
],
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock')
]
) {
node('jenkins-slave-base-pod') {
stage('Awesome stage') {
container('base') {
sh 'kubectl get po'
sh 'helm env'
}
}
}
}
Try out the above example using the jenkins-k8s-minikube project 🚀