- Clone the repository
- Navigate inside
.dockerfolder - copy
dot-envfile to.env - Optional Modify the
PROJECT_NAMEinside the.envfile - Modify
.docker/nginx/conf.d/site.confadd change theserver_name. Default iswp-docker.com - Update
hostfile for local development
- Inside the
.dockerrundocker-compose up -d - Run the command
docker run -it --rm --volumes-from WP_DOCK_wp --network container:WP_DOCK_wp --user 33:33 wordpress:cli core install --url=wp-docker.com --title="Wordpress Docker Quickstart" --admin_user=admin_user --admin_email=admin@mail.com
- This will be using the `wp-cli` image to install wordpress.
docker run -it --rm --volumes-from $WORDPRESS_CONTAINER --network container:$WORDPRESS_CONTAINER --user 33:33 wordpress:cli $COMMANDS $PARAMS
| VAR | DESC |
|---|---|
| $WORDPRESS_CONTAINER | The wordpress container name |
| $COMMANDS | The wp-cli command i.e. core install |
- Start the mysql test container
docker-compose -f docker-compose-testing.yml up -d test_db
- Build the phpunit container
docker-compose -f docker-compose-testing.yml build test_wp
- Run the test install script
docker-compose -f docker-compose-testing.yml run --rm -v $PLUGIN_DIR_PATH:/app test_wp /app/bin/install-wp-tests.sh wordpress root my-root-passwd test_db latest
-v $PLUGIN_DIR_PATH:/app- Bind mount the plugin directory to the/appfolder inside the containertest_wp- Call thetest_wpservice defiend indocker-compose-testing.yml/app/bin/install-wp-tests.sh wordpress root my-root-passwd test_db latest- Install the wordpress test script.wordpress- The database name that will be created by the install scriptroot- The mysql usermy-root-passwd- MySQL root password as specified indocker-compose-testing.ymloftest_wpservice.test_db- The service name for mysql connectionlatest- download latest wordpress version for testing
I.E.
docker-compose -f docker-compose-testing.yml run --rm -v E:\devprojects\wp-quick-dock\src\wp-content\plugins\prymag-testing:/app test_wp /app/bin/install-wp-tests.sh wordpress root my-root-passwd test_db latest
- Run
phpunit
docker-compose -f docker-compose-testing.yml run --rm -v E:\devprojects\wp-quick-dock\src\wp-content\plugins\prymag-testing:/app test_wp phpunit
- PhpMyAdmin - https://wp-docker.com/pma/
- Mailhog - https://wp-docker.com/mailhog/
docker exec -i container-name mysql -usomeusername -psomepassword db_name < dump.sql