diff --git a/php-fpm-srv/docker-compose.yaml b/docker-compose.yaml similarity index 80% rename from php-fpm-srv/docker-compose.yaml rename to docker-compose.yaml index de123a7..34dcd5f 100644 --- a/php-fpm-srv/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,13 +1,13 @@ # LEMP Linux NGINX MariaDB PHP services: - php-fpm: + multi-php-fpm: restart: unless-stopped - image: eroncero/php-fpm-srv:latest + image: eroncero/multi-php-fpm:latest volumes: #- ./etc/php/8.2/fpm/pool.d:/etc/php/8.2/fpm/pool.d - - php-fpm_pool.d:/etc/php/8.2/fpm/pool.d - - php-fpm_ipc_socketfile:/run/php/ + - multi-php-fpm_pool.d:/etc/php/8.2/fpm/pool.d + - multi-php-fpm_ipc_socketfile:/run/php/ nginx: restart: unless-stopped @@ -34,10 +34,10 @@ services: - mysql_ipc_socketfile:/run/mysqld/mysqld.sock volumes: - php-fpm_pool.d: + multi-php-fpm_pool.d: nginx_sites-available: mysql_ipc_socketfile: - php_ipc_socketfile: + multi-php-fpm_ipc_socketfile: nginx_logs: nginx_www: nginx_sites-available: diff --git a/php-fpm-srv/Dockerfile b/multi-php-fpm/Dockerfile similarity index 100% rename from php-fpm-srv/Dockerfile rename to multi-php-fpm/Dockerfile diff --git a/php-fpm-srv/project/buildtime/buildtime_php_ver_inst.sh b/multi-php-fpm/project/buildtime/buildtime_php_ver_inst.sh similarity index 100% rename from php-fpm-srv/project/buildtime/buildtime_php_ver_inst.sh rename to multi-php-fpm/project/buildtime/buildtime_php_ver_inst.sh diff --git a/php-fpm-srv/project/buildtime/sury-repo.sh b/multi-php-fpm/project/buildtime/sury-repo.sh similarity index 100% rename from php-fpm-srv/project/buildtime/sury-repo.sh rename to multi-php-fpm/project/buildtime/sury-repo.sh diff --git a/multi-php-fpm/project/entrypoint/entrypoint.sh b/multi-php-fpm/project/entrypoint/entrypoint.sh new file mode 100644 index 0000000..9ba9189 --- /dev/null +++ b/multi-php-fpm/project/entrypoint/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +/bin/sh /entrypoint/install-php-versions.sh + +# Run the CMD that was passed (or default) +#exec "$@" + +tail -f /dev/null + diff --git a/php-fpm-srv/project/entrypoint/install-php-versions.sh b/multi-php-fpm/project/entrypoint/install-php-versions.sh similarity index 96% rename from php-fpm-srv/project/entrypoint/install-php-versions.sh rename to multi-php-fpm/project/entrypoint/install-php-versions.sh index 93d5515..4821a3d 100644 --- a/php-fpm-srv/project/entrypoint/install-php-versions.sh +++ b/multi-php-fpm/project/entrypoint/install-php-versions.sh @@ -44,3 +44,5 @@ for version in $PHP_VERSIONS; do done update-alternatives --set php /usr/bin/php$DEF_PHP_INTERPRETER + +/bin/sh /entrypoint/start-php-fpm.sh diff --git a/multi-php-fpm/project/entrypoint/start-php-fpm.sh b/multi-php-fpm/project/entrypoint/start-php-fpm.sh new file mode 100644 index 0000000..b671821 --- /dev/null +++ b/multi-php-fpm/project/entrypoint/start-php-fpm.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Start each version listed in PHP_VERSIONS +for version in $PHP_VERSIONS; do + echo "Starting php$version-fpm..." + service "php$version-fpm" start +done + +# Check if BUILDTIME_PHP_VER_INST is defined and not already in PHP_VERSIONS +if [ -n "$BUILDTIME_PHP_VER_INST" ]; then + case " $PHP_VERSIONS " in + *" $BUILDTIME_PHP_VER_INST "*) + echo "BUILDTIME_PHP_VER_INST ($BUILDTIME_PHP_VER_INST) already started." + ;; + *) + echo "Starting BUILDTIME_PHP_VER_INST (php$BUILDTIME_PHP_VER_INST-fpm)..." + service "php$BUILDTIME_PHP_VER_INST-fpm" start + ;; + esac +fi + diff --git a/php-fpm-srv/project/etc/8.2/fpm/pool.d/moodle4_5.conf b/multi-php-fpm/project/etc/8.2/fpm/pool.d/moodle4_5.conf similarity index 100% rename from php-fpm-srv/project/etc/8.2/fpm/pool.d/moodle4_5.conf rename to multi-php-fpm/project/etc/8.2/fpm/pool.d/moodle4_5.conf diff --git a/php-fpm-srv/project/etc/8.2/fpm/pool.d/wordpress6.conf b/multi-php-fpm/project/etc/8.2/fpm/pool.d/wordpress6.conf similarity index 100% rename from php-fpm-srv/project/etc/8.2/fpm/pool.d/wordpress6.conf rename to multi-php-fpm/project/etc/8.2/fpm/pool.d/wordpress6.conf diff --git a/nginx-srv/Dockerfile b/nginx-srv/Dockerfile index 70e5784..cb463ac 100644 --- a/nginx-srv/Dockerfile +++ b/nginx-srv/Dockerfile @@ -1,3 +1,10 @@ FROM debian:bookworm -RUN apt-get update; apt-get full-upgrade -y +RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y + +COPY project/buildtime/gen_selfisgned_cert.sh /tmp/buildtime/gen_selfisgned_cert.sh +RUN /bin/sh /tmp/buildtime/gen_selfsigned_cert.sh + +COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh +COPY project/entrypoint/install-nginx-mods.sh /entrypoint/install-nginx-mods.sh +ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"] diff --git a/php-fpm-srv/project/entrypoint/entrypoint.sh b/nginx-srv/entrypoint/cert.sh similarity index 61% rename from php-fpm-srv/project/entrypoint/entrypoint.sh rename to nginx-srv/entrypoint/cert.sh index bf0f422..eaf8c48 100644 --- a/php-fpm-srv/project/entrypoint/entrypoint.sh +++ b/nginx-srv/entrypoint/cert.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Generate a fresh cert every time openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ @@ -10,13 +9,3 @@ echo "Generated self-signed cert:" ls -l /etc/ssl/private/ ls -l /etc/ssl/certs/ ### - -#service php8.2-fpm start # this should be started later - -/bin/sh /entrypoint/install-php-versions.sh - -# Run the CMD that was passed (or default) -#exec "$@" - -tail -f /dev/null - diff --git a/php-fpm-srv/project/entrypoint/start-php-fpm.sh b/php-fpm-srv/project/entrypoint/start-php-fpm.sh deleted file mode 100644 index a04ed3f..0000000 --- a/php-fpm-srv/project/entrypoint/start-php-fpm.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -apt-get update - -echo "Installing PHP versions: $PHP_VERSIONS" - -for version in $PHP_VERSIONS; do - echo "Installing PHP $version ..." - service "php$version-fpm" start -done