runner-action-kaniko/entrypoint.sh

19 lines
546 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2024-10-04 12:42:09 +02:00
# 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
2025-02-05 19:47:43 +01:00
printf 'cd %s -> %s\n' "$OLDPWD" "$PWD"
fi
options=()
2025-02-05 20:19:12 +01:00
if [ -n "$INPUT_CONTEXT" ]; then
options+=('--context')
options+=("$INPUT_CONTEXT")
2025-02-05 20:19:12 +01:00
fi
2024-10-04 12:42:09 +02:00
# Build container
/kaniko/executor --dockerfile "$INPUT_DOCKERFILE" --destination "$INPUT_REGISTRY/$INPUT_IMAGE" "${options[@]}"