Skip to content

Instantly share code, notes, and snippets.

@mcasperson
Created March 5, 2020 20:56
Show Gist options
  • Save mcasperson/877f5a26463bc5c6c28fbf2fb0f15426 to your computer and use it in GitHub Desktop.
Save mcasperson/877f5a26463bc5c6c28fbf2fb0f15426 to your computer and use it in GitHub Desktop.
Tekton RandomQuotes Task
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: build-docker-image-from-git-source
spec:
inputs:
resources:
- name: docker-source
type: git
params:
- name: pathToDockerFile
type: string
description: The path to the dockerfile to build
default: /workspace/docker-source/Dockerfile
- name: pathToContext
type: string
description:
The build context used by Kaniko
(https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts)
default: /workspace/docker-source
outputs:
resources:
- name: builtImage
type: image
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor:v0.17.1
# specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential
env:
- name: "DOCKER_CONFIG"
value: "/tekton/home/.docker/"
command:
- /kaniko/executor
args:
- --dockerfile=$(inputs.params.pathToDockerFile)
- --destination=$(outputs.resources.builtImage.url)
- --context=$(inputs.params.pathToContext)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment