From f44d9ef404d128608624e29a733b027d6230ec1c Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 13 Feb 2025 17:15:09 +0400 Subject: [PATCH] =?UTF-8?q?runphp:=20modifier=20s=C3=A9mantique=20de=20--c?= =?UTF-8?q?i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runphp/build | 2 +- runphp/runphp | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/runphp/build b/runphp/build index 1899e0d..c1f1cbc 100755 --- a/runphp/build +++ b/runphp/build @@ -2,7 +2,7 @@ # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 MYDIR="$(cd "$(dirname -- "$0")"; pwd)" RUNPHP="$MYDIR/runphp" -"$RUNPHP" --bs --ue || exit 1 +"$RUNPHP" --bs --ue --ci || exit 1 RUNPHP_STANDALONE= PROJDIR=; COMPOSERDIR=; COMPOSERPHAR=; VENDORDIR=; BUILDENV0=; BUILDENV= BUILD_IMAGES=(php-apache mariadb10); export BUILD_FLAVOUR=; DIST=; IMAGENAME= diff --git a/runphp/runphp b/runphp/runphp index 2d9f499..5907536 100755 --- a/runphp/runphp +++ b/runphp/runphp @@ -219,7 +219,6 @@ function host_check_projdir() { install=1 fi if [ -n "$install" ]; then - eecho "== bootstrapping runphp" [ -n "$Composer" ] || Composer=ci fi } @@ -314,6 +313,7 @@ function host_init_env() { Chdir= Verbose="$RUNPHP_VERBOSE" + Exec= } function host_docker_build() { @@ -359,7 +359,7 @@ OPTIONS paramètres pour la consruction de l'image --ci --cu - lancer composer install (resp. update) après bootstrap + lancer composer install (resp. update) s'il y a eu bootstrap --no-use-rslave paramètre montage des volumes" exit 0 @@ -404,7 +404,7 @@ OPTIONS host_check_image && exists=1 || exists= if [ -z "$UnlessExists" -o -z "$exists" ]; then - eecho "== Building $Image" + eecho "== bootstrapping $Image" args=( -f "$Dockerfile" ${Pull:+--pull} @@ -428,6 +428,9 @@ OPTIONS eecho "== Pushing $Image" docker push "$Image" || exit 1 fi + else + # s'il n'y a pas eu bootstrap, alors ne pas lancer la commande composer + Composer= fi } @@ -445,9 +448,14 @@ function host_docker_run() { runphp: lancer une commande dans un environnement PHP déterminé USAGE + $MYNAME --bs ... $MYNAME ci|cu|composer $MYNAME [options] command [args...] +COMMANDES SPECIALES + --bs + faire un bootstrap de l'image runphp + COMMANDES COMPOSER ci cu @@ -529,7 +537,7 @@ OPTIONS exec "$0" ${Chdir:+-w "$Chdir"} ) [ -n "$Verbose" ] && eecho "\$ docker ${args[*]} $*" - docker "${args[@]}" "$@" + ${Exec:+exec} docker "${args[@]}" "$@" } function container_exec() { @@ -605,12 +613,10 @@ if [ "$RUNPHP_MODE" != docker ]; then fi if [ ${#Cmd[*]} -gt 0 ]; then - host_docker_run "${Cmd[@]}" || exit $? + Exec=1 host_docker_run "${Cmd[@]}" fi else # Lancement depuis l'intérieur du container container_exec "$@" fi - -exit 0