wp-dev-lib
wp-dev-lib copied to clipboard
Provide a Docker image
Fixes #322
Include a Docker container that can be used to run all tasks.
Projects using wp-dev-lib can now use the pre-build Docker image to run all tasks supported by this tool in an environment that includes all the required dependencies and tools:
- PHP (currently set to 7.4 but could be expanded to 7.2, 7.3 and 7.4 if needed)
- Node.js
- Composer
- WordPress development files with unit test library
- Xdebug for reporting phpunit coverage
- and some others.
To use the Docker image, add docker-compose.yml to your project:
version: '3.6'
services:
wpdevlib:
image: xwpco/wp-dev-lib:latest
working_dir: /var/www/html
volumes:
- .:/var/www/html
and use the following command to run any composer or npm task in the container:
docker-compose run wpdevlib composer test
where composer test is the task to run, which can potentially call vendor/xwp/wp-dev-lib/scripts/pre-commit to run the dev-lib pre-commit hooks.