31 lines
758 B
Bash
Executable file
31 lines
758 B
Bash
Executable file
#!/bin/sh -ex
|
|
|
|
export DOCKER_CONFIG="$HOME/.docker"
|
|
mkdir -p "$DOCKER_CONFIG"
|
|
|
|
#shellcheck disable=SC1091
|
|
[ -f .env ] && . ./.env
|
|
|
|
if [ -z "$IMAGEAPP" ]; then
|
|
REGISTRY="$(echo "$GITHUB_SERVER_URL" | sed 's .*:// ')"
|
|
IMAGEAPP="$REGISTRY/$INPUT_IMAGE"
|
|
fi
|
|
|
|
if [ "$INPUT_CACHE" = true ]; then
|
|
set -- --import-cache "type=registry,ref=$IMAGEAPP/cache" \
|
|
--export-cache "type=registry,ref=$IMAGEAPP/cache"
|
|
fi
|
|
|
|
cat <<EOF > "$DOCKER_CONFIG/config.json"
|
|
{
|
|
"auths": {
|
|
"$GITHUB_SERVER_URL": {
|
|
"username": "$INPUT_USERNAME",
|
|
"password": "$INPUT_PASSWORD"
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
buildctl build "$@" -o "type=image,name=$IMAGEAPP,push=true" \
|
|
--opt filename="$INPUT_DOCKERFILE" \
|
|
--local context="$(dirname "$INPUT_DOCKERFILE")"
|