modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-10-05 11:41:38 +04:00
parent 5000baa6a1
commit 6dcf9e8fed
1 changed files with 28 additions and 12 deletions

View File

@ -65,6 +65,29 @@ function composer() {
cp composer.lock "$PROJDIR/.composer.lock.runphp"
fi
}
function ensure_image() {
local privareg imagename
if [ -z "$IMAGE" ]; then
[[ "$IMAGENAME" == */ ]] && imagename=runphp || imagename="${IMAGENAME%/*}/runphp"
privareg="$PRIVAREG"
if [ "$imagename" == runphp ]; then
[ -z "$privareg" -o "$privareg" == docker.io ] && privareg=docker.io/library
else
[ -z "$privareg" ] && privareg=docker.io
fi
IMAGE="$privareg/$imagename:$DIST"
fi
}
function check_image() {
local image="$IMAGE"
for prefix in docker.io/library/ docker.io; do
if [ "${image#$prefix}" != "$image" ]; then
image="${image#$prefix}"
break
fi
done
[ -n "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$image" 2>/dev/null)" ]
}
bootstrap=
BootstrapOnly=1
@ -201,13 +224,8 @@ if [ -z "$_RUNPHP_IN_DOCKER" ]; then
source "$PROJDIR/$BUILDENV0" || exit 1
after_source_buildenv
fi
if [ -z "$IMAGE" ]; then
[[ "$IMAGENAME" == */ ]] && imagename=runphp || imagename="${IMAGENAME%/*}/runphp"
[ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$imagename:$DIST" || IMAGE="$REGISTRY/$imagename:$DIST"
fi
if [ -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then
bootstrap=1
fi
ensure_image
check_image || bootstrap=1
fi
if [ -n "$bootstrap" ]; then
@ -300,11 +318,9 @@ OPTIONS
after_source_buildenv
fi
[ -n "$Dist" ] && DIST="$Dist"
if [ -z "$IMAGE" ]; then
[[ "$IMAGENAME" == */ ]] && imagename=runphp || imagename="${IMAGENAME%/*}/runphp"
[ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$imagename:$DIST" || IMAGE="$REGISTRY/$imagename:$DIST"
fi
if [ -z "$UnlessExists" -o -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then
ensure_image
check_image && exists=1 || exists=
if [ -z "$UnlessExists" -o -z "$exists" ]; then
eecho "== Building $IMAGE"
dockerfiles=(
"$MYDIR/Dockerfile.runphp.local"