Skip to content

Local environment setup cleanups (follow-ups to #1752) - #1753

Merged
pkevan merged 1 commit into
productionfrom
update/local-env-setup-cleanup
Jul 8, 2026
Merged

Local environment setup cleanups (follow-ups to #1752)#1753
pkevan merged 1 commit into
productionfrom
update/local-env-setup-cleanup

Conversation

@pkevan

@pkevan pkevan commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Follow-ups to #1752, batching the safe local-environment setup cleanups from a review of .docker/. Opened as a draft for review.

Changes

1. One-command host setup (package.json, .docker/readme.md)
package.json had no scripts block. Added:

  • npm run setupcomposer install + npm ci + npm run build --workspaces --if-present
  • npm run build → the workspace build alone

The readme's separate "composer install" and "npm install / npm run build" steps collapse into a single npm run setup. (npm ci replaces npm install for reproducible installs against the committed lockfile.)

2. Non-destructive git hooks (.docker/readme.md)
rm -rf .git/hooks && ln -s .githooks .git/hooksgit config core.hooksPath .githooks (git ≥ 2.9). One command, doesn't delete the hooks dir.

3. PHPUnit test suite auto-installs (.docker/Dockerfile.phpunit, new .docker/bin/install-test-suite.sh, .docker/readme.md)

  • New entrypoint waits for the DB, then installs the WP test suite on first run (idempotent; resilient — a failed download warns and still starts the container rather than crashing it). Removes the manual "exec in and run install-wp-tests.sh" step.
  • Also fixes a version drift: the container pinned yoast/phpunit-polyfills:^1.0 while composer.json requires ^4.0 — now aligned.

4. Single Docker boot command (.docker/readme.md)
docker compose build --pull + docker compose updocker compose up --build.

6. Dockerfile.php-fpm image hygiene (no behavior change)
Same packages, extensions, and config — just consolidated the ~18 layers into a handful, added --no-install-recommends + apt-get clean + rm -rf /var/lib/apt/lists/*, and &&-chained the wkhtmltopdf / WP-CLI / php.ini steps so intermediate artifacts (the wkhtmltox tarball) don't bloat a layer. Mirrors the cleanup pattern Dockerfile.phpunit already uses.

Item 5 from the review (clone WP trunk instead of a pinned branch) is in #1752, so this branch deliberately leaves readme.md step 4 untouched to avoid a conflict.

Verification

  • package.json is valid JSON; npm run setup/build resolve.
  • bash -n clean on the new entrypoint script.
  • docker build --check clean on both Dockerfiles.
  • Full docker build of both images succeeds (exit 0). The php-fpm image smoke-tests clean: WP-CLI 2.12.0, gd/intl/mysqli/zip/opcache loaded, memory_limit = 256M, msmtp + mailcatcher present. The phpunit image installs phpunit/phpunit 9.6.34 + yoast/phpunit-polyfills 4.0.0 (drift fixed).
  • The PHPUnit auto-install entrypoint's runtime path (DB wait + first-run install) wasn't exercised end-to-end here — worth a local docker compose -f docker-compose.phpunit.yml up before merging.

…erfile

Follow-ups to #1752 batching local-environment setup cleanups:
- Add `npm run setup` (composer install + npm ci + workspace build) and collapse
  the separate Composer/npm readme steps into it.
- Replace the destructive git-hooks step with `git config core.hooksPath`.
- Auto-install the PHPUnit test suite on container start (new install-test-suite.sh
  entrypoint), removing the manual step, and align the container's
  yoast/phpunit-polyfills to ^4.0 (was ^1.0, vs composer's ^4.0).
- Collapse `docker compose build --pull` + `up` into `docker compose up --build`.
- Consolidate Dockerfile.php-fpm layers and add apt cleanup (no behavior change).
@pkevan
pkevan marked this pull request as ready for review June 26, 2026 10:27
@pkevan
pkevan merged commit cbd235d into production Jul 8, 2026
@pkevan
pkevan deleted the update/local-env-setup-cleanup branch July 8, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant