diff --git a/Dockerfile b/Dockerfile index f2b35f8b..dac6132e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,35 @@ -FROM alpine:3.20 +FROM alpine:3.21 LABEL Maintainer="Tim de Pater " \ - Description="Lightweight WordPress container with Nginx 1.26 & PHP-FPM 8.3 based on Alpine Linux." + Description="Lightweight WordPress container with Nginx 1.26 & PHP-FPM 8.4 based on Alpine Linux." # Install packages RUN apk --no-cache add \ - php83 \ - php83-fpm \ - php83-mysqli \ - php83-json \ - php83-openssl \ - php83-curl \ - php83-zlib \ - php83-xml \ - php83-phar \ - php83-intl \ - php83-dom \ - php83-xmlreader \ - php83-xmlwriter \ - php83-exif \ - php83-fileinfo \ - php83-sodium \ - php83-gd \ - php83-simplexml \ - php83-ctype \ - php83-mbstring \ - php83-zip \ - php83-opcache \ - php83-iconv \ - php83-pecl-imagick \ - php83-session \ - php83-tokenizer \ + php84 \ + php84-fpm \ + php84-mysqli \ + php84-json \ + php84-openssl \ + php84-curl \ + php84-zlib \ + php84-xml \ + php84-phar \ + php84-intl \ + php84-dom \ + php84-xmlreader \ + php84-xmlwriter \ + php84-exif \ + php84-fileinfo \ + php84-sodium \ + php84-gd \ + php84-simplexml \ + php84-ctype \ + php84-mbstring \ + php84-zip \ + php84-opcache \ + php84-iconv \ + php84-pecl-imagick \ + php84-session \ + php84-tokenizer \ nginx \ supervisor \ curl \ @@ -40,8 +40,8 @@ RUN apk --no-cache add \ COPY config/nginx.conf /etc/nginx/nginx.conf # Configure PHP-FPM -COPY config/fpm-pool.conf /etc/php83/php-fpm.d/zzz_custom.conf -COPY config/php.ini /etc/php83/conf.d/zzz_custom.ini +COPY config/fpm-pool.conf /etc/php84/php-fpm.d/zzz_custom.conf +COPY config/php.ini /etc/php84/conf.d/zzz_custom.ini # Configure supervisord COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf @@ -49,7 +49,7 @@ COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # wp-content volume VOLUME /var/www/wp-content WORKDIR /var/www/wp-content -RUN chown -R nobody.nobody /var/www +RUN chown -R nobody:nobody /var/www # WordPress ENV WORDPRESS_VERSION 6.7.1 @@ -62,15 +62,15 @@ RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VER && echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \ && tar -xzf wordpress.tar.gz -C /usr/src/ \ && rm wordpress.tar.gz \ - && chown -R nobody.nobody /usr/src/wordpress + && chown -R nobody:nobody /usr/src/wordpress # Add WP CLI RUN curl -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ && chmod +x /usr/local/bin/wp # WP config -COPY wp-config.php /usr/src/wordpress -RUN chown nobody.nobody /usr/src/wordpress/wp-config.php && chmod 640 /usr/src/wordpress/wp-config.php +COPY --chown=nobody:nobody wp-config.php /usr/src/wordpress +RUN chmod 640 /usr/src/wordpress/wp-config.php # Link wp-secrets to location on wp-content RUN ln -s /var/www/wp-content/wp-secrets.php /usr/src/wordpress/wp-secrets.php diff --git a/README.md b/README.md index 08a0944c..86de733b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # WordPress Docker Container -Lightweight WordPress container with Nginx 1.26 & PHP-FPM 8.3 based on Alpine Linux. +Lightweight WordPress container with Nginx 1.26 & PHP-FPM 8.4 based on Alpine Linux. _WordPress version currently installed:_ **6.7.1** @@ -12,13 +12,13 @@ _WordPress version currently installed:_ **6.7.1** * Multi-platform, supporting AMD4, ARMv6, ARMv7, ARM64 * Built on the lightweight Alpine Linux distribution * Small Docker image size (+/-90MB) -* Uses PHP 8.3 for the best performance, low cpu usage & memory footprint +* Uses PHP 8.4 for the best performance, low cpu usage & memory footprint * Can safely be updated without losing data * Fully configurable because wp-config.php uses the environment variables you can pass as an argument to the container [![Docker Pulls](https://img.shields.io/docker/pulls/trafex/wordpress.svg)](https://hub.docker.com/r/trafex/wordpress/) ![nginx 1.26](https://img.shields.io/badge/nginx-1.26-brightgreen.svg) -![php 8.3](https://img.shields.io/badge/php-8.3-brightgreen.svg) +![php 8.4](https://img.shields.io/badge/php-8.4-brightgreen.svg) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg) ## [![Trafex Consultancy](https://timdepater.com/logo/mini-logo.png)](https://timdepater.com?mtm_campaign=github) diff --git a/config/nginx.conf b/config/nginx.conf index e3817ae7..fddf38a3 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -84,7 +84,7 @@ http { location / { # First attempt to serve request as file, then # as directory, then fall back to index.php - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php$is_args$args; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 diff --git a/config/supervisord.conf b/config/supervisord.conf index afd6e433..45c0c78d 100644 --- a/config/supervisord.conf +++ b/config/supervisord.conf @@ -4,7 +4,7 @@ logfile=/var/log/supervisord.log pidfile=/run/supervisord.pid [program:php-fpm] -command=php-fpm83 -F +command=php-fpm84 -F stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 redirect_stderr=true diff --git a/docker-compose.test.yml b/docker-compose.test.yml index f9755986..237c8e02 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -21,7 +21,7 @@ services: FS_METHOD: direct sut: - image: alpine:3 + image: alpine:3.21 depends_on: - wordpress command: /tmp/run_tests.sh diff --git a/entrypoint.sh b/entrypoint.sh index 2561ec19..2e87dac0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,7 +8,7 @@ if [ ! "$(ls -A "/var/www/wp-content" 2>/dev/null)" ]; then echo 'Setting up wp-content volume' # Copy wp-content from Wordpress src to volume cp -r /usr/src/wordpress/wp-content /var/www/ - chown -R nobody.nobody /var/www + chown -R nobody:nobody /var/www fi # Check if wp-secrets.php exists if ! [ -f "/var/www/wp-content/wp-secrets.php" ]; then diff --git a/run_tests.sh b/run_tests.sh index 0acbab3f..c23b0db6 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,4 +1,4 @@ #!/usr/bin/env sh apk --no-cache add curl -while ! curl -fs wordpress > /dev/null; do echo -n '.'; sleep 1; done; -curl --silent --fail http://wordpress/wp-admin/install.php | grep 'wp-core-ui' > /dev/null +for i in $(seq 1 10); do curl -fs wordpress > /dev/null && break || { echo -n '.'; sleep 1; }; done; +curl --silent --fail http://wordpress/wp-admin/install.php | grep 'wp-core-ui'