runner-action-kaniko/entrypoint.sh
Patrik Lundin 2138c52c9c
Bundling --context with arg in "" does not work
Try converting to bash to get access to arrays instead.
2025-02-05 20:29:37 +01:00

18 lines
546 B
Bash

#!/usr/bin/env bash
# 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\n' "$OLDPWD" "$PWD"
fi
options=()
if [ -n "$INPUT_CONTEXT" ]; then
options+=('--context')
options+=("$INPUT_CONTEXT")
fi
# Build container
/kaniko/executor --dockerfile "$INPUT_DOCKERFILE" --destination "$INPUT_REGISTRY/$INPUT_IMAGE" "${options[@]}"