sirius-press/docker/Dockerfile
Local Dev 4c5d43c4f0 sirius-press: ship wp-cli in the image
The publishing docs tell operators to run `wp sirius export` and
`wp sirius status`, and the export plugin registers both — but a stack
built from docker/ had no wp-cli at all, so those pages described a tool
nobody running the bundled image actually had.

Pinned to a version and checked against its SHA-256 rather than piped
from a URL. It is the only thing the build downloads, which is exactly
why it is the only thing that has to prove what it is.
2026-10-03 00:33:36 +02:00

95 lines
3.8 KiB
Docker

# Sirius Press — PHP-FPM image with the patched WordPress baked in.
#
# Core comes from this repository's `wordpress/` subtree, not from a download
# and not from the official `wordpress` image. That image ships whatever
# version it was tagged with, and the fork's core patch is pinned to an exact
# one; applying a fork's patch to a different core is how a setup wizard ends
# up half rewritten. Copying the vendored tree makes the image contain exactly
# what `git log wordpress/` describes, with nothing fetched at build time.
#
# Core is staged at /opt/sirius-press/core, not at the document root. The
# entrypoint copies it into place on every start, which is what makes
# `docker compose build --pull && up -d` a real upgrade: the usual layout,
# where the document root is itself a volume, pins core to whatever version
# first created that volume and turns every security release into a manual
# migration.
#
# GMP is installed because the wallet cryptography runs in PHP. Without it the
# fork falls back to BCMath, which works and is roughly twenty times slower —
# unavoidable on a shared host, wasteful in a container we control.
FROM php:8.3-fpm-bookworm
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates curl \
libfreetype6-dev libjpeg62-turbo-dev libpng-dev libwebp-dev \
libzip-dev libgmp-dev libicu-dev \
; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j"$(nproc)" \
bcmath gd gmp intl mysqli opcache zip exif \
; \
rm -rf /var/lib/apt/lists/*
# Settings a WordPress host wants and the PHP image does not set.
RUN { \
echo 'upload_max_filesize = 64M'; \
echo 'post_max_size = 64M'; \
echo 'memory_limit = 256M'; \
echo 'max_execution_time = 120'; \
echo 'opcache.memory_consumption = 128'; \
echo 'opcache.max_accelerated_files = 10000'; \
echo 'opcache.revalidate_freq = 2'; \
echo 'expose_php = Off'; \
} > /usr/local/etc/php/conf.d/sirius-press.ini
# --- wp-cli ------------------------------------------------------------------
#
# docs/publishing.md documents `wp sirius export`, and the export plugin ships
# a WP-CLI command, so an image without wp-cli makes those pages describe a
# tool the operator does not have. Pinned and checksummed rather than piped
# from a URL: this is the one thing in the image that is fetched at build
# time, so it is the one thing that has to prove what it is.
ENV WP_CLI_VERSION=2.12.0
ENV WP_CLI_SHA256=ce34ddd838f7351d6759068d09793f26755463b4a4610a5a5c0a97b68220d85c
RUN set -eux; \
curl -fsSL -o /usr/local/bin/wp \
"https://github.com/wp-cli/wp-cli/releases/download/v${WP_CLI_VERSION}/wp-cli-${WP_CLI_VERSION}.phar"; \
echo "${WP_CLI_SHA256} /usr/local/bin/wp" | sha256sum -c -; \
chmod 755 /usr/local/bin/wp; \
wp --allow-root --version
# --- core, from the subtree --------------------------------------------------
COPY wordpress/ /opt/sirius-press/core/
RUN set -eux; \
test -f /opt/sirius-press/core/wp-includes/version.php; \
sed -n "s/.*wp_version = '\\(.*\\)'.*/\\1/p" \
/opt/sirius-press/core/wp-includes/version.php \
> /opt/sirius-press/core/.sirius-core-version; \
echo "vendored WordPress $(cat /opt/sirius-press/core/.sirius-core-version)"
# --- the fork -----------------------------------------------------------------
#
# The patch is already applied in the subtree, so there is nothing to patch
# here. patches/ is carried for auditing, not for building.
WORKDIR /opt/sirius-press/core
COPY plugins/ /opt/sirius-press/core/wp-content/plugins/
COPY mu-plugins/ /opt/sirius-press/core/wp-content/mu-plugins/
COPY docker/entrypoint.sh /usr/local/bin/sirius-entrypoint
RUN chmod +x /usr/local/bin/sirius-entrypoint; \
mkdir -p /var/www/html /var/www/config; \
chown -R www-data:www-data /var/www/html /var/www/config
WORKDIR /var/www/html
ENTRYPOINT ["sirius-entrypoint"]
CMD ["php-fpm"]