diff --git a/dockerfile b/dockerfile index 64ff592..366f162 100644 --- a/dockerfile +++ b/dockerfile @@ -11,6 +11,25 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ slapd ldap-utils gnutls-bin ssl-cert ca-certificates schema2ldif vim mc && apt-get clean +# ────────────────────────────────────────────────────────────── +# APACHE + PHP + everything phpLDAPadmin needs +# ────────────────────────────────────────────────────────────── +RUN apt-get update && apt-get install -y --no-install-recommends \ + apache2 \ + php libapache2-mod-php \ + php-ldap php-mbstring php-xml php-curl php-intl wget \ + && rm -rf /var/lib/apt/lists/* + +# Enable required Apache modules +RUN a2enmod rewrite headers ssl + +# Use mpm_prefork (required for PHP) +RUN a2dismod mpm_event && a2enmod mpm_prefork + +# Clean up default Apache site +RUN rm -rf /var/www/html/* && \ + echo "" > /var/www/html/info.php + # preconfigure slapd installation without using systemd RUN echo "slapd slapd/password1 password admin" | debconf-set-selections && \ echo "slapd slapd/password2 password admin" | debconf-set-selections && \ diff --git a/entrypoint.sh b/entrypoint.sh index 0b5c08d..f917abe 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -144,10 +144,25 @@ fi kill $SLAPD_PID 2>/dev/null || true wait $SLAPD_PID 2>/dev/null || true -# Final strict slapd + keep interactive shell (THE CORRECT WAY) -echo "--> Starting final strict slapd — you keep your shell" +# Start OpenLDAP in background +echo "--> Starting final OpenLDAP (background)" slapd -h "ldap:/// ldaps:/// ldapi:///" -u openldap -g openldap -d 0 & +SLAPD_PID=$! -echo "--> ldapdock ready — marisa password = MarisaNewPass2025" -export LDAPTLS_REQCERT=allow +# Start Apache in background +echo "--> Starting Apache + PHP (background)" +apache2ctl -D FOREGROUND & +APACHE_PID=$! + +# Victory message +echo "--> ldapdock ready — OpenLDAP + Apache + PHP running" +echo " → LDAP: 389/636" +echo " → Web: http://localhost/info.php" +echo " → Shell: you are here forever" +echo " → Stop with Ctrl+C" + +# THIS IS THE MAGIC LINE — explained below +trap 'echo "Stopping services..."; kill $SLAPD_PID $APACHE_PID 2>/dev/null; wait' SIGINT SIGTERM + +# Give you your interactive shell — forever exec "$@"