améliorer la prise en charge dans les projets

This commit is contained in:
Jephté Clain 2024-05-12 15:07:31 +04:00
parent f42dcb978a
commit f94db2a69d
4 changed files with 67 additions and 4 deletions

View File

@ -549,6 +549,7 @@ function action() {
__action "$action" 1>&2
fi
eval "$NULIB__ENABLE_SET_X"
return $r
}
function asuccess() {
@ -559,6 +560,7 @@ function asuccess() {
NULIB__INDENT=" " __asuccess "$*" 1>&2
NULIB__ESTACK="${NULIB__ESTACK%:a}"
eval "$NULIB__ENABLE_SET_X"
return 0
}
function afailure() {
# terminer l'action en cours avec le message d'échec $*
@ -568,6 +570,7 @@ function afailure() {
NULIB__INDENT=" " __afailure "$*" 1>&2
NULIB__ESTACK="${NULIB__ESTACK%:a}"
eval "$NULIB__ENABLE_SET_X"
return 1
}
function aresult() {
# terminer l'action en cours avec un message de succès ou d'échec $2..* en
@ -584,6 +587,7 @@ function aresult() {
fi
NULIB__ESTACK="${NULIB__ESTACK%:a}"
eval "$NULIB__ENABLE_SET_X"
return $r
}
function adone() {
# terminer l'action en cours avec le message neutre $*
@ -592,4 +596,5 @@ function adone() {
[ -n "$*" ] && NULIB__INDENT=" " __adone "$*" 1>&2
NULIB__ESTACK="${NULIB__ESTACK%:a}"
eval "$NULIB__ENABLE_SET_X"
return 0
}

30
support/Dockerfile.cli Normal file
View File

@ -0,0 +1,30 @@
# -*- 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
FROM $REGISTRY/src/base as base
FROM $REGISTRY/src/php as php
################################################################################
FROM debian:${NDIST}-slim as builder
COPY --from=base /g/ /g/
COPY --from=base /src/ /src/
ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE
ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE
RUN /g/build core lite _builder
RUN make -C /src/su-exec
################################################################################
FROM debian:${NDIST}-slim
COPY --from=builder /src/su-exec/su-exec /g/
COPY --from=base /g/ /g/
ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE
ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE
RUN /g/build
COPY --from=php /g/ /g/
RUN /g/build @php-cli php-utils
ENTRYPOINT ["/g/entrypoint"]

View File

@ -13,12 +13,16 @@ VENDORDIR=
BUILDENV0=
BUILDENV=
# Listes des images que le script build construit automatiquement
BUILD_IMAGES=(web db)
## En ce qui concerne DIST et IMAGENAME, les valeurs dans BUILDENV prennent le
## dessus. Elles n'ont donc besoin d'être spécifiées que si BUILDENV *n'est pas*
## utilisé.
# version de debian à utiliser pour l'image
# d12=php8.2, d11=php7.4, d10=php7.3
DIST=
# Nom de base de l'image (sans le registry), e.g prefix/rundk
IMAGENAME=
# Listes des images que le script build construit automatiquement
BUILD_IMAGES=(web db)

View File

@ -1,13 +1,20 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source /etc/nulib.sh || exit 1
source "$(dirname "$0")/../load.sh" || exit 1
projdir=
args=(
"Mettre à jour le script rundk"
"[path/to/rundk]"
-d:,--projdir:PROJDIR . "Copier les fichiers pour un projet"
)
parse_args "$@"; set -- "${args[@]}"
if [ -n "$projdir" ]; then
setx projdir=abspath "$projdir"
set -- "$projdir/sbin/rundk"
fi
rundk="${1:-.}"
[ -d "$rundk" ] && rundk="$rundk/rundk"
@ -38,8 +45,10 @@ p == 1 {
}
}
' >"$userconf"
initial_config=
else
userconf="$MYDIR/rundk.userconf"
initial_config=1
fi
(
@ -52,3 +61,18 @@ fi
[ -x "$rundk" ] || chmod +x "$rundk"
rsync -lpt "$MYDIR/Dockerfile.rundk" "$rundir/"
if [ -n "$projdir" ]; then
if should_update "$rundir/build" "$MYDIR/build"; then
cp "$MYDIR/build" "$rundir/build"
chmod +x "$rundir/build"
fi
if [ ! -f "$projdir/.build.env.dist" ]; then
sed <"$MYDIR/dot-build.env.dist" >"$projdir/.build.env.dist" '
/^IMAGENAME=/s/=.*\//='"$(basename -- "$projdir")"'\//
'
initial_config=1
fi
fi
[ -n "$initial_config" ]