Refactor Dockerfiles and scripts to streamline installation and configuration processes
This commit is contained in:
parent
a4c01aac2e
commit
8deb1c3223
2
Makefile
2
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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
FROM alpine:3.20
|
||||
|
||||
# Accept build argument for host user ID
|
||||
|
||||
ARG HOST_UID=1000
|
||||
|
||||
RUN apk add --no-cache \
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user