1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-12-11 07:50:29 +00:00
catalog/kaniko
Vincent Demeester 323e8d05f1 Update README to change inputs/params levels
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
2020-03-06 09:01:47 -06:00
..
tests Port kaniko to v1beta1 🦇 2020-03-06 07:49:46 -06:00
kaniko.yaml Port kaniko to v1beta1 🦇 2020-03-06 07:49:46 -06:00
README.md Update README to change inputs/params levels 2020-03-06 09:01:47 -06:00

Kaniko

This Task builds source into a container image using Google's kaniko tool.

kaniko doesn't depend on a Docker daemon and executes each command within a Dockerfile completely in userspace. This enables building container images in environments that can't easily or securely run a Docker daemon, such as a standard Kubernetes cluster.

kaniko is meant to be run as an image, gcr.io/kaniko-project/executor:v0.9.0. This makes it a perfect tool to be part of Tekton.

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/kaniko/kaniko.yaml

Parameters

  • DOCKERFILE: The path to the Dockerfile to execute (default: ./Dockerfile)

  • CONTEXT: The build context used by Kaniko (default: ./)

Resources

Inputs

  • source: A git-type PipelineResource specifying the location of the source to build.

Outputs

  • image: An image-type PipelineResource specifying the image that should be built.

ServiceAccount

kaniko builds an image and pushes it to the destination defined as a parameter. In order to properly authenticate to the remote container registry, it needs to have the proper credentials. This is achieved using a ServiceAccount.

For an example on how to create such a ServiceAccount to push an image to DockerHub, see the Authentication documentation page.

Usage

This TaskRun runs the Task to fetch a Git repo, and build and push a container image using Kaniko

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: example-run
spec:
  taskRef:
    name: kaniko
  resources:
    inputs:
    - name: source
      resourceSpec:
        type: git
        params:
        - name: url
          value: https://github.com/my-user/my-repo
    outputs:
    - name: image
      resourceSpec:
        type: image
        params:
        - name: url
          value: gcr.io/my-repo/my-image