kaniko/entrypoint.sh

29 lines
544 B
Bash
Executable File

#!/bin/sh -ex
#shellcheck disable=SC1091
cd "./${INPUT_DOCKERFILE%/*}"
[ -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 .*:// ')"
IMAGEAPP="$REGISTRY/$INPUT_IMAGE"
fi
/kaniko/executor \
--cache="$INPUT_CACHE" \
--context . \
--destination "$IMAGEAPP" \
--dockerfile "${INPUT_DOCKERFILE##*/}"