Last active
March 11, 2021 09:03
-
-
Save mysticrenji/81ce4b35c00fe97fffbeb2fb69b1d94a to your computer and use it in GitHub Desktop.
Jenkinsfile for Docker
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
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