- Clone the repository
- Navigate inside
.docker
folder - copy
dot-env
file to.env
- Optional Modify the
PROJECT_NAME
inside the.env
file - Modify
.docker/nginx/conf.d/site.conf
add change theserver_name
. Default iswp-docker.com
- Update
host
file for local development
- Inside the
.docker
rundocker-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 [email protected]
- 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/app
folder inside the containertest_wp
- Call thetest_wp
service 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.yml
oftest_wp
service.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