diff --git a/action.yml b/action.yml index 5e7abed..630e820 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index 713499c..3f6d271 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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"