Skip to content

Instantly share code, notes, and snippets.

@otaviosoares
Created December 27, 2016 04:47
Show Gist options
  • Save otaviosoares/fc132dcb863e75161431ed00b95f06ba to your computer and use it in GitHub Desktop.
Save otaviosoares/fc132dcb863e75161431ed00b95f06ba to your computer and use it in GitHub Desktop.
podTemplate(label: 'mypod', cloud: 'Kubernetes',
containers: [
containerTemplate(name: 'jenkins-jnlp', image: 'artyou/jenkins-slave:0.1.2', command: 'cat', ttyEnabled: true, privileged: true),
containerTemplate(name: 'jnlp', image: 'jenkinsci/jnlp-slave:alpine', args: '${computer.jnlpmac} ${computer.name}', privileged: true),
],
volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')]) {
node('mypod') {
stage('build and test') {
checkout scm
docker.image('mhart/alpine-node:4.4.3').inside {
env.NODE_ENV = "test"
sh 'apk add --update make gcc g++ python git'
sh 'npm install'
sh 'npm test'
}
}
stage('push-image') {
docker.withRegistry('http://localhost:5000') {
def img = docker.build("artyou/company")
img.push(commit)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment