mirror of
https://github.com/bvanroll/stage-infra.git
synced 2025-08-29 03:52:49 +00:00
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
apiVersion: tekton.dev/v1alpha1
|
|
kind: Task
|
|
metadata:
|
|
name: build-image
|
|
namespace: tekton-pipeline-1
|
|
spec:
|
|
params:
|
|
- name: DOCKERFILE
|
|
description: Path to the Dockerfile to build.
|
|
default: ./Dockerfile
|
|
- name: CONTEXT
|
|
description: The build context used by Kaniko.
|
|
default: ./
|
|
- name: EXTRA_ARGS
|
|
default: ""
|
|
- name: BUILDER_IMAGE
|
|
description: The image on which builds will run
|
|
default: gcr.io/kaniko-project/executor:v0.13.0
|
|
- name: build-type
|
|
description: build type used to check if this step needs to run without full pipeline failure
|
|
default: dockerfile
|
|
workspaces:
|
|
- name: source
|
|
mountpath: /source
|
|
outputs:
|
|
resources:
|
|
- name: image
|
|
type: image
|
|
steps:
|
|
- name: build-and-push
|
|
workingDir: /workspace/source
|
|
image: $(params.BUILDER_IMAGE)
|
|
# specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential
|
|
# https://github.com/tektoncd/pipeline/pull/706
|
|
env:
|
|
- name: DOCKER_CONFIG
|
|
value: /tekton/home/.docker
|
|
command:
|
|
- /kaniko/executor
|
|
- $(inputs.EXTRA_ARGS)
|
|
- --dockerfile=/source/$(params.DOCKERFILE)
|
|
- --context=/workspace/source/$(params.CONTEXT) # The user does not need to care the workspace and the source.
|
|
- --destination=$(outputs.resources.image.url)
|
|
securityContext:
|
|
runAsUser: 0 |