modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-03-27 18:19:14 +04:00
parent 2ca4332063
commit 635e513a8b
3 changed files with 41 additions and 12 deletions

View File

@ -1,10 +1,12 @@
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
ARG NDIST=12
ARG REGISTRY=pubdocker.univ-reunion.fr ARG REGISTRY=pubdocker.univ-reunion.fr
FROM $REGISTRY/src/base as base FROM $REGISTRY/src/base as base
FROM $REGISTRY/src/php as php FROM $REGISTRY/src/php as php
################################################################################ ################################################################################
FROM debian:11-slim as builder FROM debian:${NDIST}-slim as builder
COPY --from=base /g/ /g/ COPY --from=base /g/ /g/
COPY --from=base /src/ /src/ COPY --from=base /src/ /src/
@ -12,7 +14,7 @@ RUN /g/build core lite _builder
RUN make -C /src/su-exec RUN make -C /src/su-exec
################################################################################ ################################################################################
FROM debian:11-slim FROM debian:${NDIST}-slim
COPY --from=builder /src/su-exec/su-exec /g/ COPY --from=builder /src/su-exec/su-exec /g/
COPY --from=base /g/ /g/ COPY --from=base /g/ /g/

View File

@ -16,3 +16,4 @@ PRIVAREG=
# Ne pas toucher à partir d'ici # Ne pas toucher à partir d'ici
REGISTRY=pubdocker.univ-reunion.fr REGISTRY=pubdocker.univ-reunion.fr
DIST=d12

View File

@ -29,8 +29,13 @@ COMPOSERPHAR=
VENDORDIR= VENDORDIR=
# fichier de configuration pour le build # fichier de configuration pour le build
BUILDENV0=
BUILDENV= BUILDENV=
# version de debian à utiliser pour l'image
# d12=php8.2, d11=php7.4, d10=php7.3
DIST=
################################################################################ ################################################################################
# Ne pas modifier à partir d'ici # Ne pas modifier à partir d'ici
@ -38,9 +43,12 @@ BUILDENV=
[ -n "$COMPOSERDIR" ] || COMPOSERDIR=. [ -n "$COMPOSERDIR" ] || COMPOSERDIR=.
[ -n "$COMPOSERPHAR" ] || COMPOSERPHAR=sbin/composer.phar [ -n "$COMPOSERPHAR" ] || COMPOSERPHAR=sbin/composer.phar
[ -n "$VENDORDIR" ] || VENDORDIR=vendor [ -n "$VENDORDIR" ] || VENDORDIR=vendor
[ -n "$BUILDENV0" ] || BUILDENV0=.build.env.dist
[ -n "$BUILDENV" ] || BUILDENV=build.env [ -n "$BUILDENV" ] || BUILDENV=build.env
[ -n "$DIST" ] || DIST=d12
[ "$COMPOSERPHAR" == none ] && COMPOSERPHAR= [ "$COMPOSERPHAR" == none ] && COMPOSERPHAR=
[ "$BUILDENV0" == none ] && BUILDENV0=
[ "$BUILDENV" == none ] && BUILDENV= [ "$BUILDENV" == none ] && BUILDENV=
function eecho() { echo "$*" 1>&2; } function eecho() { echo "$*" 1>&2; }
@ -68,14 +76,20 @@ function composer() {
bootstrap= bootstrap=
BootstrapOnly=1 BootstrapOnly=1
ForcedBootstrap= ForcedBootstrap=
parse_opts=1
args=() args=()
for arg in "$@"; do for arg in "$@"; do
if [ "$arg" == --bootstrap ]; then if [ -z "$parse_opts" ]; then
args+=("$arg")
elif [ "$arg" == --bootstrap ]; then
bootstrap=1 bootstrap=1
elif [ "$arg" == --exec ]; then elif [ "$arg" == --exec ]; then
BootstrapOnly= BootstrapOnly=
elif [[ "$arg" == -* ]]; then
args+=("$arg")
else else
args+=("$arg") args+=("$arg")
parse_opts=
fi fi
done done
set -- "${args[@]}" set -- "${args[@]}"
@ -170,14 +184,16 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then
else else
UseRslave=1 UseRslave=1
fi fi
IMAGENAME=nulib/rundk IMAGENAME="nulib/rundk"
if [ -z "$bootstrap" ]; then if [ -z "$bootstrap" ]; then
if [ -f "$PROJDIR/$BUILDENV" ]; then if [ -n "$BUILDENV" -a -f "$PROJDIR/$BUILDENV" ]; then
source "$PROJDIR/$BUILDENV" || exit 1 source "$PROJDIR/$BUILDENV" || exit 1
elif [ -n "$BUILDENV0" -a -f "$PROJDIR/$BUILDENV0" ]; then
source "$PROJDIR/$BUILDENV0" || exit 1
fi fi
if [ -z "$IMAGE" ]; then if [ -z "$IMAGE" ]; then
[ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME" || IMAGE="$REGISTRY/$IMAGENAME" [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME:$DIST" || IMAGE="$REGISTRY/$IMAGENAME:$DIST"
fi fi
if [ -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then if [ -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then
bootstrap=1 bootstrap=1
@ -193,12 +209,18 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then
TIMEZONE TIMEZONE
) )
SOPTS=+c:UjDx:z:r:pw:v SOPTS=+d:9876543210:c:UjDx:z:r:pw:v
LOPTS=help,config:,unless-exists,pull,no-cache,plain-output,apt-proxy:,timezone:,privareg:,push,chdir:,verbose,no-use-rslave LOPTS=help,dist:,d19,d18,d17,d16,d15,d14,d13,d12,d11,d10,config:,unless-exists,pull,no-cache,plain-output,apt-proxy:,timezone:,privareg:,push,chdir:,verbose,no-use-rslave
args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args" args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args"
[ -f "$PROJDIR/$BUILDENV" ] && Config="$PROJDIR/$BUILDENV" || Config= Dist=
Build= if [ -n "$BUILDENV" -a -f "$PROJDIR/$BUILDENV" ]; then
Config="$PROJDIR/$BUILDENV"
elif [ -n "$BUILDENV0" -a -f "$PROJDIR/$BUILDENV0" ]; then
Config="$PROJDIR/$BUILDENV0"
else
Config=
fi
UnlessExists= UnlessExists=
Pull= Pull=
NoCache= NoCache=
@ -232,8 +254,10 @@ OPTIONS
afficher plus d'informations" afficher plus d'informations"
exit 0 exit 0
;; ;;
-d|--dist) shift; Dist="$1";;
-[0-9]) Dist="d1${1#-}";;
--d*) Dist="${1#--}";;
-c|--config) shift; Config="$1";; -c|--config) shift; Config="$1";;
-0|--build) Build=1;;
--unless-exists) UnlessExists=1;; --unless-exists) UnlessExists=1;;
-U|--pull) Pull=1;; -U|--pull) Pull=1;;
-j|--no-cache) NoCache=1;; -j|--no-cache) NoCache=1;;
@ -254,8 +278,9 @@ OPTIONS
if [ -n "$Config" ]; then if [ -n "$Config" ]; then
source "$Config" || exit 1 source "$Config" || exit 1
fi fi
[ -n "$Dist" ] && DIST="$Dist"
if [ -z "$IMAGE" ]; then if [ -z "$IMAGE" ]; then
[ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME" || IMAGE="$REGISTRY/$IMAGENAME" [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME:$DIST" || IMAGE="$REGISTRY/$IMAGENAME:$DIST"
fi fi
if [ -z "$UnlessExists" -o -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then if [ -z "$UnlessExists" -o -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then
eecho "== Building $IMAGE" eecho "== Building $IMAGE"
@ -265,6 +290,7 @@ OPTIONS
${NoCache:+--no-cache} ${NoCache:+--no-cache}
${BuildPlain:+--progress plain} ${BuildPlain:+--progress plain}
-t "$IMAGE" -t "$IMAGE"
--build-arg "NDIST=${DIST#d}"
) )
for arg in "${BUILD_ARGS[@]}"; do for arg in "${BUILD_ARGS[@]}"; do
args+=(--build-arg "$arg=${!arg}") args+=(--build-arg "$arg=${!arg}")