79 lines
1.9 KiB
YAML
79 lines
1.9 KiB
YAML
apiVersion: tekton.dev/v1
|
|
kind: Task
|
|
metadata:
|
|
name: docker-registry
|
|
spec:
|
|
params:
|
|
- name: home
|
|
type: string
|
|
default: ""
|
|
description: home directory
|
|
|
|
- name: workshop
|
|
type: string
|
|
default: ""
|
|
description: workshop within the repo where the source code is located
|
|
|
|
- name: imageName
|
|
type: string
|
|
description: Base image name with registry (e.g. docker.unbox-x.net/registry/unbox-x-aisi-cron-app)
|
|
|
|
- name: tag
|
|
type: string
|
|
description: Version tag to apply to the image (e.g. v0.2.0)
|
|
|
|
- name: dockerfile
|
|
type: string
|
|
default: ./Dockerfile
|
|
description: Path to Dockerfile
|
|
|
|
- name: context
|
|
type: string
|
|
default: .
|
|
description: Build context path (relative to workshop)
|
|
|
|
workspaces:
|
|
- name: shared
|
|
description: Source code workspace
|
|
|
|
results:
|
|
- name: imageUrl
|
|
description: Final pushed image URL with tag (e.g. registry/app:v0.2.0)
|
|
|
|
steps:
|
|
- name: prepare-docker
|
|
image: alpine:3.21.3
|
|
workingDir: /workspace/shared/$(params.workshop)
|
|
env:
|
|
- name: HOME
|
|
value: /workspace/shared/$(params.home)
|
|
|
|
script: |
|
|
#!/bin/sh
|
|
set -e
|
|
|
|
ls -al $HOME
|
|
ls -al $HOME/.docker
|
|
|
|
IMAGE="$(params.imageName):$(params.tag)"
|
|
echo "📦 Using image: $IMAGE"
|
|
echo -n "$IMAGE" > /tekton/results/imageUrl
|
|
|
|
- name: kaniko-build
|
|
image: gcr.io/kaniko-project/executor:v1.23.2
|
|
workingDir: $(workspaces.shared.path)/$(params.workshop)
|
|
env:
|
|
- name: HOME
|
|
value: /workspace/shared/$(params.home)
|
|
- name: DOCKER_CONFIG
|
|
value: $HOME/.docker
|
|
command:
|
|
- /kaniko/executor
|
|
args:
|
|
- --dockerfile=$(params.dockerfile)
|
|
- --context=$(params.context)
|
|
- --destination=$(params.imageName):$(params.tag)
|
|
- --skip-tls-verify
|
|
- --verbosity=info
|
|
- --reproducible
|