This commit is contained in:
2025-08-04 15:39:20 +09:00
parent e6c919ec2f
commit 8ffec5a5a7
5 changed files with 48 additions and 96 deletions

View File

@ -1,27 +1,36 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-image
name: build-docker-image
namespace: tekton-demo
spec:
params:
- name: IMAGE
- name: git-url
type: string
- name: git-revision
type: string
default: "main"
- name: image-url
type: string
description: Image name to build
steps:
- name: git-clone
image: alpine/git
script: |
#!/bin/sh
set -e
git clone $(params.git-url) source
cd source
git checkout $(params.git-revision)
- name: build-and-push
image: gcr.io/kaniko-project/executor:latest
args:
- "--dockerfile=/workspace/source/Dockerfile"
- "--context=/workspace/source/"
- "--destination=$(params.IMAGE)"
volumeMounts:
- name: docker-config
mountPath: /kaniko/.docker
workspaces:
- name: source
volumes:
- name: docker-config
secret:
secretName: harbor-dockerconfig
env:
- name: DOCKER_CONFIG
value: /tekton/home/.docker/
script: |
#!/busybox/sh
/kaniko/executor \
--dockerfile=./Dockerfile \
--context=source \
--destination=$(params.image-url) \
--insecure \
--insecure-push