kaniko/entrypoint.sh
2024-11-29 04:24:27 +00:00

29 lines
804 B
Bash
Executable File

#!/bin/sh -ex
[ -f .env ] && . ./.env
cat <<EOF > /kaniko/.docker/config.json
{
"auths": {
"$GITHUB_SERVER_URL": {
"username": "$INPUT_USERNAME",
"password": "$INPUT_PASSWORD"
}
}
}
EOF
if [ -z "$IMAGEAPP" ]; then
REGISTRY="$(echo "$GITHUB_SERVER_URL" | sed 's .*:// ')"
printf '%s' "$INPUT_IMAGE"
printf '%s' "$INPUT_IMAGE" | tr '[:upper:]' '[:lower:]' | tr -c '[:lower:][:digit:]-/:_' _
printf '%s' "$INPUT_IMAGE" | tr '[:upper:]' '[:lower:]' | tr -c '[:lower:][:digit:]-:_' _
IMAGEAPP="$REGISTRY/$(printf '%s' "$INPUT_IMAGE" | tr '[:upper:]' '[:lower:]' | tr -c '[:lower:][:digit:]-/:_' _)"
fi
/kaniko/executor \
--cache="$INPUT_CACHE" \
--context "${INPUT_DOCKERFILE%/*}" \
--dockerfile "$INPUT_DOCKERFILE" \
--destination "$IMAGEAPP"