Skip to content

Replace wp-env with Docker Compose#55

Merged
rkoopmans merged 26 commits intotinify:masterfrom
wcreateweb:replace-wp-env-docker-compose
Jun 10, 2025
Merged

Replace wp-env with Docker Compose#55
rkoopmans merged 26 commits intotinify:masterfrom
wcreateweb:replace-wp-env-docker-compose

Conversation

@tijmenbruggeman
Copy link
Copy Markdown
Collaborator

@tijmenbruggeman tijmenbruggeman commented Jun 10, 2025

Summary
Replaced wp-env with docker compose, which will resolve the issues with failing integration tests. This change allows more control over the CI workflow, improved stability while running and faster tests (from 8 minutes to 3 minutes on average).

Description
Recently the integration test builds started failing.

#14 [tests-wordpress  9/19] RUN apt-get -qy install autoconf 		dpkg-dev 		file 		g++ 		gcc 		libc-dev 		make 		pkg-config 		re2c && touch /usr/local/etc/php/php.ini
#14 0.131 Reading package lists...
#14 0.561 Building dependency tree...
#14 0.631 Reading state information...
#14 0.697 autoconf is already the newest version (2.69-10).
#14 0.697 g++ is already the newest version (4:6.3.0-4).
#14 0.697 gcc is already the newest version (4:6.3.0-4).
#14 0.697 make is already the newest version (4.1-9.1).
#14 0.697 pkg-config is already the newest version (0.29-4+b1).
#14 0.697 re2c is already the newest version (0.16-2).
#14 0.697 The following additional packages will be installed:
#14 0.697   libc-dev-bin libc6 libdpkg-perl libmagic-mgc libmagic1
#14 0.698 Suggested packages:
#14 0.698   debian-keyring glibc-doc libc-l10n locales manpages-dev gnupg | gnupg2
#14 0.698 Recommended packages:
#14 0.698   build-essential fakeroot gnupg | gnupg2 libalgorithm-merge-perl manpages
#14 0.698   manpages-dev libfile-fcntllock-perl liblocale-gettext-perl
#14 0.732 The following packages will be upgraded:
#14 0.733   dpkg-dev file libc-dev-bin libc6 libc6-dev libdpkg-perl libmagic-mgc
#14 0.733   libmagic1
#14 0.734 8 upgraded, 0 newly installed, 0 to remove and 65 not upgraded.
#14 0.734 Need to get 8601 kB of archives.
#14 0.734 After this operation, 16.4 kB of additional disk space will be used.
#14 0.734 WARNING: The following packages cannot be authenticated!
#14 0.734   libc6-dev libc-dev-bin libc6 file libmagic1 libmagic-mgc dpkg-dev
#14 0.734   libdpkg-perl
#14 0.736 E: There were unauthenticated packages and -y was used without --allow-unauthenticated
#14 ERROR: process "/bin/sh -c apt-get -qy install $PHPIZE_DEPS && touch /usr/local/etc/php/php.ini" did not complete successfully: exit code: 100

The build was using an outdated apt cache which caused a mismatch between metadata. As we have no control of the build of wp-env I was unable to fix this. Besides this point it was also a flaky and slow which was not helping the preference of wp-env. Not being able to control the exact configuration was holding us back from making changes faster. Therefor going back to a docker compose will be better for now. Maybe once wp-env will be more mature we can move back to it.

Changes

  • There are no official docker images for WordPress below 4.6. Therefor decided to use 4.6 for now. We can decide to build our own 4.0 WordPress image. Wouldn't want to rely on a unknown 4.0 image.
  • Playwright was moved to dev dependancy so the cache check was failing earlier own. Now it correctly refers to devDependencies
  • Changed run command:
    • bin/run-wordpress [wp version] [php version] will use the official wordpress image to start a docker compose stack including a matching wp-cli and a database. This uses mariadb, same as wp-env. Some good to knows:
      • the docker volume wordpress_data makes a shared volume between wp-cli and wordpress containers. This allows wp cli to download plug-ins and make changes. Therefor we do have to run the cli as user 33 (www-data on the WordPress container).
      • we can use aliases now instead of the gateway, which makes it easier to run locally
  • Healthchecks are used to ensure other containers are ready
  • Removed some flakyness from the integration tesgts.

@rkoopmans rkoopmans merged commit 8a39b9c into tinify:master Jun 10, 2025
9 checks passed
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.

2 participants