Try supporting a workdir

This is where kaniko is executed.
This commit is contained in:
Patrik Lundin 2025-02-05 19:44:39 +01:00
parent 4a8753d498
commit 6afbf1ce25
Signed by: patlu
GPG key ID: A0A812BA2249F294
2 changed files with 9 additions and 1 deletions

View file

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

View file

@ -3,5 +3,10 @@
# Setup auth
echo '{"auths":{"'"$(printf "%s" "$INPUT_REGISTRY")"'":{"auth":"'"$(printf "%s" "$INPUT_CREDENTIAL" | base64 | tr -d '\n')"'"}}}' > /kaniko/.docker/config.json
if [ -n "$INPUT_WORKDIR" ]; then
cd "$INPUT_WORKDIR" || exit 1
printf 'cd %s -> %s' "$OLDPWD" "$PWD"
fi
# Build container
/kaniko/executor --dockerfile $INPUT_DOCKERFILE --destination "$INPUT_REGISTRY/$INPUT_IMAGE"
/kaniko/executor --dockerfile "$INPUT_DOCKERFILE" --destination "$INPUT_REGISTRY/$INPUT_IMAGE"