Sign inSign up

andidittrich/wp-dev

By andidittrich

Updated over 7 years ago

WordPress plugin development test runtime

Image
0

164

andidittrich/wp-dev repository overview

WordPress Plugin-Test Runtime

DO NOT USE THIS IMAGE IN PRODUCTION

As a WordPress plugin developer you often need a "clean" testing environment to test your plugin against different php versions, different WordPress releases or cross-plugin-compatibility.

This testing environment is build upon php-runtime-dev running the php build-in webserver.

It requires an external MySQL Database as storage backend. The wp-config.php has been changed to accept a simple DSN to configure the database credentials via a single environment variable!

Usage

Each of your plugins should contain a dedicated dockerfile which extends this runtime. See Cryptex Plugin or Enlighter Plugin for real-world scenarios.

DSN String

The database source name (passed as WP_DSN env variable) has the following structure. The fragment is optionally used as table-prefix (default: wp_)

DSN: mysql://user:passwd@host/table_name#table_prefix

Example Setup

FROM wp-dev

# copy release files to wordpress plugin directory
COPY --chown="www-data:www-data" dist/ /srv/public/wp-content/plugins/enlighter

Run Container

# build the test container
docker build -t myplugin-runtime .

# run container in interactive mode. remove container on close (ctrl+c)
docker run -p 8080:8080 --rm -e WP_DSN="mysql://user:[email protected]/wordpress_test" --interactive --name myplugin-test myplugin-runtime

Tag summary

Content type

Image

Digest

Size

72.9 MB

Last updated

over 7 years ago

docker pull andidittrich/wp-dev