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."