Inspired by lyzs90/vuewp repository structure, this is a Docker Compose project with config files, scripts and automations to run and deploy wordpress project. Using this, any theme (including SPA themes) needs be a separated repository, or a composer dependency.
- Docker for a deterministic and easy to set up development environment
- Composer for install wp plugins/themes and others PHP libraries, and run phpunit tests. The command is installed in wordpress-tools docker image
- Custom shell scripts for wordpress-tools image commands, similar to Docker aliases
- PHPUNIT for unit/integration wordpress plugin tests
- PHPCS to detect violations of a defined coding standard.
- WP-CLI A command-line tool to wordpress management
- Set up a Docker and Docker Compose environment
- Clone this repo
git clone https://github.com/mfdeveloper/docker-images.git - Copy the script aliases from
./docker-aliasesto any folder of your$PATHenvironment variable (e.g~/.docker/aliases) - Install the dependencies
composer install - Start Wordpress and MySQL
docker-compose up -d wordpress db - Add your container ip (e.g localhost) to
.env.exampleand rename to.env(or change the.envdirectly) - Access the Wordpress server at this url http://<CONTAINER_IP>:8000 and perform the famous 5-minute install
- Enjoy it!
Into ./db-backup directory, you can backup/restore all databases
- dumpSql(): Generate a
mysql.databases.sqlfile with all databases
Usage:
dumpSql wordpress-docker-compose_1
- restoreSql(): Restore a
mysql.databases.sqlfile into mysqldbservice
Usage:
restoreSql wordpress-docker-compose_1
- dumpFolder(): Generate a
mysql.databases.tar.gzcompressed file with all databases
Usage:
dumpSql wordpress-docker-compose_1
- restoreFolder(): Restore a
mysql.databases.sqlfile into mysqldbservice
Usage:
restoreSql wordpress-docker-compose_1
These scripts are used to configure/run phpunit tests of one or more wordpress plugins.
PS: For run the commands below, you need stay on this root project folder, relative to
composer.jsonfile:
- addTestFiles: Run
wp scaffold plugin-testswith wp-cli to generate files to configure tests
Usage:
composer addTestFiles --plugin <my-wp-plugin>
- installWpTests: Run
install-wp-tests.shfile, to createwordpress_testdatabase for tests
Usage:
composer installWpTests
- test: Run tests of a wordpress plugin. Use
--pluginargument to pass a plugin name
Usage:
composer test -- --plugin <my-wp-plugin>
- Adapted from lyzs90/vuewp, and separated after the discussion on lyzs90/vuewp!4 pull request
- A custom
composerscript to download a.zipfile language-pack by
the current wp language, and store the.moand.pofile inwp-content/languages/plugins/