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-aliases
to any folder of your$PATH
environment 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.example
and rename to.env
(or change the.env
directly) - 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.sql
file with all databases
Usage:
dumpSql wordpress-docker-compose_1
- restoreSql(): Restore a
mysql.databases.sql
file into mysqldb
service
Usage:
restoreSql wordpress-docker-compose_1
- dumpFolder(): Generate a
mysql.databases.tar.gz
compressed file with all databases
Usage:
dumpSql wordpress-docker-compose_1
- restoreFolder(): Restore a
mysql.databases.sql
file into mysqldb
service
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.json
file:
- addTestFiles: Run
wp scaffold plugin-tests
with wp-cli to generate files to configure tests
Usage:
composer addTestFiles --plugin <my-wp-plugin>
- installWpTests: Run
install-wp-tests.sh
file, to createwordpress_test
database for tests
Usage:
composer installWpTests
- test: Run tests of a wordpress plugin. Use
--plugin
argument 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
composer
script to download a.zip
file language-pack by
the current wp language, and store the.mo
and.po
file inwp-content/languages/plugins/