init
This commit is contained in:
parent
1bc9347b7b
commit
b48019e360
@ -23,7 +23,7 @@ spec:
|
||||
default: ./Dockerfile
|
||||
|
||||
- name: context
|
||||
description: Build context path
|
||||
description: Build context path (relative to subdirectory)
|
||||
type: string
|
||||
default: .
|
||||
|
||||
@ -40,13 +40,13 @@ spec:
|
||||
|
||||
steps:
|
||||
- name: build-and-push
|
||||
image: alpine:3.18
|
||||
image: gcr.io/kaniko-project/executor:v1.23.2
|
||||
workingDir: /workspace/source
|
||||
env:
|
||||
- name: DOCKER_CONFIG
|
||||
value: /tekton/home/.docker/
|
||||
value: /tekton/home/.docker
|
||||
script: |
|
||||
#!/bin/sh
|
||||
#!/busybox/sh
|
||||
set -e
|
||||
|
||||
if [ -n "$(params.subdirectory)" ]; then
|
||||
@ -57,14 +57,12 @@ spec:
|
||||
|
||||
IMAGE="$(params.imageName):$(params.tag)"
|
||||
echo "📦 Using image: $IMAGE"
|
||||
echo -n "$IMAGE" > /tekton/results/imageUrl
|
||||
|
||||
echo "🔐 Loading Docker credentials..."
|
||||
USERNAME=$(cat /workspace/docker-auth/username)
|
||||
PASSWORD=$(cat /workspace/docker-auth/password)
|
||||
REGISTRY=$(echo "$IMAGE" | cut -d/ -f1)
|
||||
|
||||
echo "📝 Writing Docker config for $REGISTRY"
|
||||
echo "🔐 Creating Docker config for $REGISTRY"
|
||||
mkdir -p /tekton/home/.docker
|
||||
cat > /tekton/home/.docker/config.json <<EOF
|
||||
{
|
||||
@ -78,14 +76,14 @@ spec:
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "📥 Installing Kaniko executor..."
|
||||
wget -q -O /kaniko.tar.gz https://github.com/GoogleContainerTools/kaniko/releases/download/v1.17.0/executor-linux-amd64.tar.gz
|
||||
tar -xzf /kaniko.tar.gz -C /usr/local/bin
|
||||
chmod +x /usr/local/bin/executor
|
||||
|
||||
echo "🚀 Building and pushing image with Kaniko..."
|
||||
executor \
|
||||
echo "🚀 Building and pushing with Kaniko..."
|
||||
/kaniko/executor \
|
||||
--dockerfile=$(params.dockerfile) \
|
||||
--context="$(params.context)" \
|
||||
--context=$(params.context) \
|
||||
--destination="$IMAGE" \
|
||||
--skip-tls-verify
|
||||
--skip-tls-verify \
|
||||
--reproducible \
|
||||
--verbosity=info
|
||||
|
||||
echo "✅ Build complete. Saving image URL..."
|
||||
echo -n "$IMAGE" > /tekton/results/imageUrl
|
||||
|
Loading…
x
Reference in New Issue
Block a user