Files
docker-images/_CI-CD/tekton-sintra-hello-world.yaml

81 lines
2.1 KiB
YAML

apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: sinatra-hello-world-git
spec:
type: git
params:
- name: revision
value: main
- name: url
value: https://github.com/BrianMMcClain/sinatra-hello-world
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: sinatra-hello-world-tekton-demo-image
spec:
type: image
params:
- name: url
value: docker-registry.lan/sinatra-hello-world-tekton-demo
- name:
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-docker-image-from-git-source
spec:
params:
- name: pathToDockerFile
type: string
description: The path to the dockerfile to build
default: $(resources.inputs.docker-source.path)/Dockerfile
- name: pathToContext
type: string
description: |
The build context used by Kaniko
(https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts)
default: $(resources.inputs.docker-source.path)
resources:
inputs:
- name: docker-source
type: git
outputs:
- name: builtImage
type: image
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor:arm64
# 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=$(params.pathToDockerFile)
- --destination=$(resources.outputs.builtImage.url)
- --context=$(params.pathToContext)
- --skip-tls-verify
---
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: build-docker-image-from-git-source-task-run
spec:
#serviceAccountName: dockerhub-service
taskRef:
name: build-docker-image-from-git-source
params:
- name: pathToDockerFile
value: Dockerfile
resources:
inputs:
- name: docker-source
resourceRef:
name: sinatra-hello-world-git
outputs:
- name: builtImage
resourceRef:
name: sinatra-hello-world-tekton-demo-image