Add support for setting --context

This commit is contained in:
Patrik Lundin 2025-02-05 20:19:12 +01:00
parent 721c7174d7
commit a516d1e2a2
Signed by: patlu
GPG key ID: A0A812BA2249F294
2 changed files with 9 additions and 1 deletions

View file

@ -15,6 +15,9 @@ inputs:
workdir: workdir:
description: 'path to directory where kaniko is executed' description: 'path to directory where kaniko is executed'
default: '' default: ''
context:
description: 'path supplied to --context'
default: ''
runs: runs:
using: docker using: docker
image: Dockerfile image: Dockerfile

View file

@ -8,5 +8,10 @@ if [ -n "$INPUT_WORKDIR" ]; then
printf 'cd %s -> %s\n' "$OLDPWD" "$PWD" printf 'cd %s -> %s\n' "$OLDPWD" "$PWD"
fi fi
context_flag=""
if [ -n "$INPUT_CONTEXT" ]; then
context_flag="--context $INPUT_CONTEXT"
fi
# Build container # Build container
/kaniko/executor --dockerfile "$INPUT_DOCKERFILE" --destination "$INPUT_REGISTRY/$INPUT_IMAGE" /kaniko/executor --dockerfile "$INPUT_DOCKERFILE" --destination "$INPUT_REGISTRY/$INPUT_IMAGE" "$context_flag"