Skip to content

Instantly share code, notes, and snippets.

@mysticrenji
Last active March 11, 2021 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mysticrenji/81ce4b35c00fe97fffbeb2fb69b1d94a to your computer and use it in GitHub Desktop.
Save mysticrenji/81ce4b35c00fe97fffbeb2fb69b1d94a to your computer and use it in GitHub Desktop.
Jenkinsfile for Docker
podTemplate(yaml: """
apiVersion: v1
kind: Pod
spec:
containers:
- name: docker
image: docker:1.11
command: ['cat']
tty: true
volumeMounts:
- name: dockersock
mountPath: /var/run/docker.sock
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
"""
) {
def image = "mysticrenji/javaapp"
node(POD_LABEL) {
stage('Build Docker image') {
git 'https://github.com/mysticrenji/jenkins-k8s-cluster-terraform.git'
container('docker') {
sh "docker build -t ${image} ."
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment