cluster.fun/tekton/tasks/docker-build-and-publish.yaml

57 lines
1.3 KiB
YAML
Raw Normal View History

2020-04-25 18:18:33 +00:00
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: docker-build-and-publish
namespace: tekton-pipelines
spec:
params:
- name: DOCKERFILE
type: string
description: The path to the dockerfile to build
default: /Dockerfile
- name: CONTEXT
type: string
description: The build context used by Docker.
default: ./
- name: IMAGE
type: string
description: Name (reference) of the image to build.
- name: EXTRA_ARGS
type: string
default: ""
resources:
inputs:
- name: src
type: git
results:
- name: IMAGE_DIGEST
description: Digest of the image just built.
steps:
- name: build-and-push
workingDir: /workspace/src
image: gcr.io/kaniko-project/executor:latest
env:
- name: DOCKER_CONFIG
2020-05-07 16:06:08 +00:00
value: /kaniko/.docker
2020-04-25 18:18:33 +00:00
command:
- /kaniko/executor
- $(params.EXTRA_ARGS)
- --dockerfile=/workspace/src/$(params.DOCKERFILE)
- --context=/workspace/src/$(params.CONTEXT)
- --destination=$(params.IMAGE)
- --oci-layout-path=/workspace/src/image-digest
- --digest-file=/tekton/results/IMAGE_DIGEST
securityContext:
runAsUser: 0
2020-05-07 16:06:08 +00:00
volumeMounts:
- name: docker-config
mountPath: /kaniko/.docker/config.json
subPath: config.json
volumes:
- name: docker-config
secret:
secretName: docker-config