apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: kaniko-build-task
spec:
  inputs:
    resources:
      - name: git-repo
        type: git
    params:
      - name: dockerfilePath
        type: string
        description: Path to the Dockerfile to build
        default: /workspace/git-repo/Dockerfile
  outputs:
    resources:
      - name: builtImage
        type: image
  steps:
    - name: load-config
      image: ubuntu
      script: |
        # Load configuration from a file and export as environment variables
        source /workspace/git-repo/config.env
    - name: kaniko-build
      image: gcr.io/kaniko-project/executor:latest
      command: ["/kaniko/executor"]
      args:
        - --dockerfile=${inputs.params.dockerfilePath}
        - --context=dir:///workspace/git-repo
        - --destination=${outputs.resources.builtImage}
        - --build-arg=FOO=${FOO}