Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
FROM alpine:3.20
FROM alpine:3.21
LABEL Maintainer="Tim de Pater <[email protected]>" \
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 \
Expand All @@ -40,16 +40,16 @@ 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

# 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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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**

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
FS_METHOD: direct

sut:
image: alpine:3
image: alpine:3.21
depends_on:
- wordpress
command: /tmp/run_tests.sh
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -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'
Loading