diff --git a/README.md b/README.md index 8d7c51260..79213f000 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,28 @@ PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, 2. `$ ./vendor/bin/phpunit` 3. `$ ./vendor/bin/phpcs` +### Docker + +You can also use the Docker environment which includes WP, WC and all developments tools. + +0. Install Docker and Docker Compose. +1. `$ cp .env.example .env` and edit the configuration in the `.env` file if needed. +2. `$ yarn run docker:build` (or copy the commands from [package.json](/package.json) if you do not have `yarn`). +3. `$ yarn docker:install` +4. `$ yarn docker:start` +5. Add `127.0.0.1 wc-pp.myhost` to your `hosts` file and open http://wc-pp.myhost (the default value of `WP_DOMAIN` in `.env`). + +Tests and code style: +- `$ yarn run docker:test` +- `$ yarn run docker:lint` + +After some changes in `.env` (such as PHP, WP versions) you may need to rebuild the Docker image: + +1. `$ yarn run docker:destroy` (all data will be lost) +2. `$ yarn run docker:build` + +See [package.json](/package.json) for other useful commands. + ## Preparation for wordpress.org release If you want to deploy a new version, you need to do some preparation: diff --git a/package.json b/package.json index eabea103c..0813e371c 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,19 @@ "build:modules": "yarn run build:modules:ppcp-button && yarn build:modules:ppcp-wc-gateway", "build:dev": "yarn run install:modules && yarn run build:modules", + "docker:build": "docker-compose build", + "docker:start": "docker-compose up -d wp_dev", + "docker:stop": "docker-compose down", + "docker:destroy": "docker-compose down -v", + "docker:logs": "docker-compose logs", + "docker:shell": "docker-compose run --rm wp_dev bash", + "docker:install": "docker-compose run --rm composer composer install && yarn run docker:build-js", + "docker:build-js": "docker-compose run --rm build yarn run build:dev", + "docker:composer-update": "docker-compose run --rm composer composer update", + "docker:test": "docker-compose run --rm test vendor/bin/phpunit", + "docker:lint": "docker-compose run --rm test vendor/bin/phpcs --parallel=8 -n -s", + "docker:fix-lint": "docker-compose run --rm test vendor/bin/phpcbf", + "prebuild": "rm -rf ./vendor", "build": "composer install --no-dev && npm run build:dev && npm run archive", "prearchive": "rm -rf $npm_package_name.zip",