{"id":20558859,"url":"https://github.com/sarahcssiqueira/docker-wordpress","last_synced_at":"2025-10-04T02:30:34.231Z","repository":{"id":177383065,"uuid":"658074823","full_name":"sarahcssiqueira/docker-wordpress","owner":"sarahcssiqueira","description":"Docker WordPress Environment focused on the development of plugins and themes, supports WP-CLI, PhpMyAdmin, Xdebug and wpcs.","archived":false,"fork":false,"pushed_at":"2023-07-26T14:56:51.000Z","size":37,"stargazers_count":7,"open_issues_count":5,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T18:44:03.252Z","etag":null,"topics":["docker","docker-wordpress","dockerfile"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sarahcssiqueira.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-24T17:26:57.000Z","updated_at":"2025-02-06T05:26:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"38c9e13c-b960-4c5e-a049-3d234596d2b8","html_url":"https://github.com/sarahcssiqueira/docker-wordpress","commit_stats":null,"previous_names":["sarahcssiqueira/docker-wordpress"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sarahcssiqueira/docker-wordpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahcssiqueira%2Fdocker-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahcssiqueira%2Fdocker-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahcssiqueira%2Fdocker-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahcssiqueira%2Fdocker-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sarahcssiqueira","download_url":"https://codeload.github.com/sarahcssiqueira/docker-wordpress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarahcssiqueira%2Fdocker-wordpress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278254791,"owners_count":25956679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-wordpress","dockerfile"],"created_at":"2024-11-16T03:47:21.098Z","updated_at":"2025-10-04T02:30:33.939Z","avatar_url":"https://github.com/sarahcssiqueira.png","language":"Dockerfile","funding_links":["https://www.buymeacoffee.com/sarahcssiqueira"],"categories":[],"sub_categories":[],"readme":"# Docker WordPress Environment\r\n\r\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n[![Release Version](https://img.shields.io/github/release/sarahcssiqueira/docker-wordpress.svg)](https://github.com/sarahcssiqueira/docker-wordpress/releases/latest)\r\n[![Support Level](https://img.shields.io/badge/support-may_take_time-yellow.svg)](#support-level)\r\n\r\nThis is a **Docker WordPress Environment** focused on the development of **WordPress plugins and themes**, supports [WP-CLI](https://wp-cli.org/), [phpMyAdmin](https://www.phpmyadmin.net/), [Xdebug](https://xdebug.org/) and [WordPress Coding Standards - WPCS](https://github.com/WordPress/WordPress-Coding-Standards).\r\n\r\n---\r\n\r\n\u003e **Disclaimer:** This project is meant to be used for development purposes only. It's **not** meant to be used in production.\r\n\r\n---\r\n\r\n## Table of Contents\r\n\r\n- [Introduction](#docker-wordpress-environment)\r\n- [Requirements](#requirements)\r\n- [Docker](#docker)\r\n- [Folders Structure](#folders-structure)\r\n- [Containers](#containers)\r\n- [Basic Usage](#basic-usage)\r\n  - [Set variables](#variables)\r\n  - [Starting Docker](#starting-docker)\r\n- [More Tools](#more-tools)\r\n  - [Set debugging in WordPress](#set-debugging-in-wordPress)\r\n  - [Xdebug for VSCode](#xdebug-for-vscode)\r\n  - [Set WordPress Coding Standards](#set-wordpress-coding-standards)\r\n  - [Using WordPress Coding Standards](#using-wordpress-coding-standards)\r\n- [Contributing and Support](#contributing-and-support)\r\n\r\n## Requirements\r\n\r\n- [Docker](https://www.docker.com/)\r\n- [VS Code](https://code.visualstudio.com/)\r\n  - [PHP Debug Extension](https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug)\r\n  - [phpcs](https://github.com/sarahcssiqueira/docker-wordpress/blob/master/.vscode/settings.json)\r\n- [Composer](https://getcomposer.org/)\r\n- [Xdebug](https://xdebug.org/docs/install)\r\n\r\n## Docker\r\n\r\n### Folders Structure\r\n\r\n![docker folder](https://github.com/sarahcssiqueira/docker-wordpress/assets/82296194/eef4010b-9c13-49a8-970b-1a707666defd)\r\n\r\n- .vscode\r\n- db\r\n- docker: also install Xdebug and set Xdebug.ini.\r\n- plugins\r\n- themes\r\n- wp-core\r\n- .gitignore\r\n- composer.json\r\n- license\r\n- readme\r\n\r\n### Containers\r\n\r\nDocker containers used on [docker-compose. yml](https://github.com/sarahcssiqueira/docker-wordpress/blob/master/docker/docker-compose.yml):\r\n\r\n- WordPress: Uses the official WordPress latest docker image.\r\n- WP-CLI: The **wpcli container** was added to only run one-off commands. Don’t need it to run as a service, only as a cli tool, for that run `docker-compose run --rm wpcli command`\r\n- db: The MYSQL official image.\r\n- phpMyAdmin: Intended to handle the administration of MySQL, in this case through port 80, on browser [localhost:8080](localhost:8080).\r\n\r\n## Basic usage\r\n\r\nClone (or download) this repository `git clone https://github.com/sarahcssiqueira/docker-wordpress` or download one of the [latest releases](https://github.com/sarahcssiqueira/docker-wordpress/releases).\r\nGo to the `/docker` folder and set up your chosen variables on the .env file.\r\n\r\n### Set variables\r\n\r\nThe variables used for WordPress installation are the following ones, you can use the same or change them, it's up to you.\r\n\r\n```\r\nMYSQL_DATABASE_NAME=exampledatabase\r\nMYSQL_USER=exampleuser\r\nMYSQL_PASSWORD=examplepass\r\n```\r\n\r\n---\r\n\r\n\u003e WARNING: DO NOT store your variables on a .env file, a better approach would be to add the .env file to a .gitignore and store the variables as [encrypted secrets.](https://docs.github.com/en/actions/security-guides/encrypted-secrets).\r\n\r\n---\r\n\r\n### Starting Docker\r\n\r\nAfter setting your variables, run `docker-compose up -d` to start the Docker.\r\n\r\nWhen Docker finishes their work (can take a few minutes at the first time, depending on your connection and machine), you will see the WordPress default installation screen in your browser.\r\n\r\nFinish WordPress installation.\r\n\r\n![wp-setup-start](https://github.com/sarahcssiqueira/docker-wordpress/assets/82296194/0ac267b6-b2a6-44c2-aa29-a4092d62b80d)\r\n\r\nIn your terminal, cd the root project folder again to start working on your plugins and/or themes.\r\n\r\nFor using wp-cli, use `docker-compose run --rm wpcli command` as it was added to only run one-off commands.\r\n\r\n🚀 You already can start to work on your themes and plugins, but there are more tools available for using, keep reading.\r\n\r\n## ⚙️ More Tools\r\n\r\n### Debugging in WordPress\r\n\r\nThe wp-core is synchronized through the docker-composer.yml just in case you need to check and/or debug something. After running `docker-compose up -d`, you will be able to change the [WordPress debug mode](https://wordpress.org/documentation/article/debugging-in-wordpress/) by changing the following lines on the **wp-config.php** file inside the wp-core folder.\r\n\r\nBy default, the wp-config.php generated by Docker will look something like this:\r\n\r\n```\r\ndefine( 'WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', '') );\r\n```\r\n\r\nReplace it with the following:\r\n\r\n```\r\ndefine( 'WP_DEBUG', true);\r\n\r\ndefine( 'WP_DEBUG_LOG' , true );\r\n\r\ndefine ( 'WP_DEBUG_DISPLAY', true );\r\n```\r\n\r\nMore info about **debugging in WordPress** you can find [here](https://wordpress.org/documentation/article/debugging-in-wordpress/).\r\n\r\n### Xdebug for VSCode\r\n\r\nXdebug will be installed by the docker file as you can see in\r\n\r\n```\r\nRUN pecl install xdebug\r\nRUN docker-php-ext-enable xdebug\r\n```\r\n\r\nXdebug is enabled and configured to work on VSCode using the extension PHP Debug, [install it](https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug). The settings are already configured according to the extension documentation, in the **launch.json** file on the **.vscode folder**, including the pathMapping for remote host debugging.\r\n\r\n```\r\n\"pathMappings\": {\r\n\"/var/www/html\": \"${workspaceRoot}/wp-core\",\r\n                \"/var/www/html/wp-content/plugins\": \"${workspaceRoot}/plugins\",\r\n                \"/var/www/html/wp-content/themes\": \"${workspaceRoot}/themes\"\r\n}\r\n```\r\n\r\n### Set WordPress Coding Standards\r\n\r\nThere are several ways to config WordPress Coding Standards, but in this environment, we will manage it through Composer. To use WordPress Coding Standards we also need to install PHP Code Sniffer.\r\nIf you inspect the composer.json on the root folder of the project, you will see the lines:\r\n\r\n```\r\n\"require-dev\": {\r\n    \"squizlabs/php_codesniffer\": \"^3.7\",\r\n    \"wp-coding-standards/wpcs\": \"^2.3\",\r\n}\r\n```\r\n\r\nThey are responsible to install PHP Code Sniffer and WordPress Coding Standards when you run:\r\n\r\n`composer install`\r\n\r\nAfter that, Composer will download the necessaire dependencies to the vendor folder. To check if it works, run:\r\n\r\n`./vendor/bin/phpcs -i`\r\n\r\nOn the first time, the expected output will be:\r\n\r\n_The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, and Zend_\r\n\r\nTo use WPCS, we have \"to tell\" the PHP Code Sniffer about the WordPress Coding Standards. For that, run the command:\r\n\r\n`./vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs`\r\n\r\nTo confirm if it works, run `./vendor/bin/phpcs -i ` again, and the expected output this time should be:\r\n\r\n_The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs, and WordPress-Extra_\r\n\r\nThis way, WordPress Coding Standards are available for all plugins and themes you work with inside this Docker environment.\r\n\r\n### Using wpcs\r\n\r\nFor VS Code **\"to understand the standards\"**, we need some extension, my chosen one was the phpcs. Install it. The settings are already configured according to the phpcs extension documentation, in the **settings.json** on the **.vscode folder** in this repository.\r\n\r\nIf you installed everything correctly because the `\"phpcs.lintOnSave\": true,` line on settings.json, when you hit save any PHP file, it will be linted correctly and the warnings/errors will be displayed on the problems tab of your IDE aka VS Code. We can also run the following commands on the terminal to check a single file:\r\n\r\n`./vendor/bin/phpcbf --standard=\"WordPress\" /file-name.php`\r\n\r\nTo display a report on the terminal:\r\n\r\n`./vendor/bin/phpcs --standard=\"WordPress\" /file-name.php`\r\n\r\nWe can also run the commands to check all the files at once in the project but may experience performance issues depending on your project size, may be even necessaire to adjust our php.ini directives like the max_execution_time. **For that reason, use the following commands carefully**.\r\n\r\n`./vendor/bin/phpcbf --standard=\"WordPress\" .`\r\n\r\nTo display a report on the terminal:\r\n\r\n`./vendor/bin/phpcs --standard=\"WordPress\" .`\r\n\r\n# 🤝 Contributing and Support\r\n\r\nIt's **work in progress.** Feel free to contribute informing about [issues](https://github.com/sarahcssiqueira/docker-wordpress/issues) or even through [pull requests](https://github.com/sarahcssiqueira/docker-wordpress/pulls) for improvements.\r\n\r\n❤️ Support [buying me a coffee](https://www.buymeacoffee.com/sarahcssiqueira).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarahcssiqueira%2Fdocker-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsarahcssiqueira%2Fdocker-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarahcssiqueira%2Fdocker-wordpress/lists"}