From 57d05cc85d21cb280c742957d5bf74aa1e52214d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A8ve=20Caillault?= Date: Mon, 22 Jun 2026 20:23:16 +0200 Subject: [PATCH] Ajout des options --apache et --frankenphp pour le script de construction de l'image. --- README.md | 13 ++++++++----- scripts/build-docker-image.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c2c8425..d48e267 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,15 @@ Le script `./scripts/build-docker-image.sh` génère automatiquement la commande Exemple : ```bash -./scripts/build-docker-image.sh --debug --build +./scripts/build-docker-image.sh --debug --build --apache +./scripts/build-docker-image.sh --debug --build --frankenphp ``` ### Options -| Option | Description | -| --------- | ------------------------------------------------------ | -| `--debug` | Affiche la commande de construction de l'image. | -| `--build` | Exécute la construction de l'image Docker. | +| Option | Description | +| -------------- | ------------------------------------------------------ | +| `--debug` | Affiche la commande de construction de l'image. | +| `--build` | Exécute la construction de l'image Docker. | +| `--apache` | Utilise une image Apache. | +| `--frankenphp` | Utilise une image FrankenPHP. | \ No newline at end of file diff --git a/scripts/build-docker-image.sh b/scripts/build-docker-image.sh index d75ea3d..a695ec0 100755 --- a/scripts/build-docker-image.sh +++ b/scripts/build-docker-image.sh @@ -13,6 +13,9 @@ serverVersion="" serverName="" withDebug=false withBuild=false +withApacheOption=false +withFrankenphpOption=false + for arg in "$@"; do case "$arg" in @@ -22,9 +25,32 @@ for arg in "$@"; do --build) withBuild=true ;; + --apache) + withApacheOption=true + ;; + --frankenphp) + withFrankenphpOption=true + ;; esac done +# Traitement des options --apache et --frankenphp +if [[ "$withApacheOption" == "true" ]]; then + if [[ "$APACHE_PHP_IMAGE" == "" ]]; then + echo "La variable d'environnement APACHE_PHP_IMAGE n'est pas définie." + exit 1 + else + SERVER_PHP_IMAGE=$APACHE_PHP_IMAGE + fi +elif [[ "$withFrankenphpOption" == "true" ]]; then + if [[ "$FRANKENPHP_IMAGE" == "" ]]; then + echo "La variable d'environnement FRANKENPHP_IMAGE n'est pas définie." + exit 1 + else + SERVER_PHP_IMAGE=$FRANKENPHP_IMAGE + fi +fi + # Vérifie que le repository de l'image est définie if [[ "$SERVER_IMAGE_REPOSITORY" == "" ]]; then echo "Le repository de l'image est inconnu. Veuillez définir la variable d'environnement SERVER_IMAGE_REPOSITORY."