diff --git a/Makefile b/Makefile index 14c8792..b6a3230 100644 --- a/Makefile +++ b/Makefile @@ -66,8 +66,6 @@ clean: @echo "$(gub)Removing Docker images...$(reset)" @docker rmi -f $(shell docker images -q) - - logs: @echo "$(gub)Displaying logs...$(reset)" @$(DC) logs diff --git a/srcs/requirements/adminer/Dockerfile b/srcs/requirements/adminer/Dockerfile index a3a15e1..bedcfe4 100644 --- a/srcs/requirements/adminer/Dockerfile +++ b/srcs/requirements/adminer/Dockerfile @@ -2,7 +2,6 @@ FROM alpine:3.20 ARG HOST_UID=1000 -# Install PHP-FPM and dependencies for Adminer RUN apk add --no-cache \ php83 \ php83-fpm \ @@ -14,11 +13,9 @@ RUN apk add --no-cache \ curl && \ rm -rf /var/cache/apk/* -# Create user with matching UID RUN addgroup -g ${HOST_UID} adminer && \ adduser -D -u ${HOST_UID} -G adminer adminer -# Create web directory and download Adminer RUN mkdir -p /var/www/html && \ curl -L https://github.com/vrana/adminer/releases/download/v5.3.0/adminer-5.3.0.php -o /var/www/html/adminer.php && \ chown -R adminer:adminer /var/www/html diff --git a/srcs/requirements/ftp/Dockerfile b/srcs/requirements/ftp/Dockerfile index 38577ae..4d14c90 100644 --- a/srcs/requirements/ftp/Dockerfile +++ b/srcs/requirements/ftp/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.20 -# Accept build argument for host user ID + ARG HOST_UID=1000 RUN apk add --no-cache \ diff --git a/srcs/requirements/ftp/tools/docker-entrypoint.sh b/srcs/requirements/ftp/tools/docker-entrypoint.sh index a6dcec5..51551a2 100644 --- a/srcs/requirements/ftp/tools/docker-entrypoint.sh +++ b/srcs/requirements/ftp/tools/docker-entrypoint.sh @@ -3,7 +3,6 @@ adduser -D -u "${HOST_UID}" -h /var/www/html -s /bin/false "${FTP_USER}" 2>/dev/null || true echo "${FTP_USER}:${FTP_PASS}" | chpasswd mkdir -p /var/www/html -# chown -R "${FTP_USER}:${FTP_USER}" /var/www/html echo "${FTP_USER}" > /etc/vsftpd.userlist exec vsftpd /etc/vsftpd/vsftpd.conf diff --git a/srcs/requirements/wordpress/Dockerfile b/srcs/requirements/wordpress/Dockerfile index d9279d2..0d3c959 100644 --- a/srcs/requirements/wordpress/Dockerfile +++ b/srcs/requirements/wordpress/Dockerfile @@ -37,18 +37,12 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli COPY ./conf/www.conf /etc/php83/php-fpm.d/www.conf -RUN echo "memory_limit = 512M" >> /etc/php83/php.ini +RUN echo "memory_limit = 512M" >> /etc/php83/php.ini && \ + echo 'sendmail_path = "/usr/sbin/sendmail -S mailhog:1025"' >> /etc/php83/php.ini - - -# Copy and set permissions for the install script COPY ./tools/install.sh /usr/local/bin/install.sh RUN chmod +x /usr/local/bin/install.sh - -# Switch to the new user - - ENTRYPOINT ["/usr/local/bin/install.sh"] CMD ["php-fpm83", "-F"] diff --git a/srcs/requirements/wordpress/tools/install.sh b/srcs/requirements/wordpress/tools/install.sh index 443b026..7ee4eee 100644 --- a/srcs/requirements/wordpress/tools/install.sh +++ b/srcs/requirements/wordpress/tools/install.sh @@ -1,20 +1,12 @@ #!/bin/sh -# Set sendmail_path in php.ini for PHP 8.3 FPM -PHP_INI="/etc/php83/php.ini" -if [ -f "$PHP_INI" ]; then - sed -i '/^sendmail_path/d' "$PHP_INI" - echo 'sendmail_path = "/usr/sbin/sendmail -S mailhog:1025"' >> "$PHP_INI" -fi -# This script is used to install WordPress and configure it with a MariaDB database. -# It checks for the presence of a database and user, creates them if they don't exist, -# and sets up the WordPress configuration file with the database connection details. +if [ -f /var/www/html/wp-config.php ]; then + echo "WordPress is already installed." + exec "$@" +fi echo "Installing WordPress..." sleep 10 - -# Check if the database exists - echo "wp core download --allow-root --path=/var/www/html" wp core download --allow-root --path=/var/www/html @@ -68,17 +60,6 @@ wp config set --allow-root \ wp redis enable --allow-root \ --path=/var/www/html -# wp config set --allow-root \ -# SMTP_SERVER \ -# "mailhog" \ -# --type=constant \ -# --path=/var/www/html -# wp config set --allow-root \ -# SMTP_PORT \ -# 1025 \ -# --type=constant \ -# --path=/var/www/html - echo "WordPress installation completed." chown -R wordpress:wordpress /var/www/html