57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
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
|
|
value: /kaniko/.docker
|
|
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
|
|
volumeMounts:
|
|
- name: docker-config
|
|
mountPath: /kaniko/.docker/config.json
|
|
subPath: config.json
|
|
volumes:
|
|
- name: docker-config
|
|
secret:
|
|
secretName: docker-config
|
|
|
|
|
|
|