{"id":18036643,"url":"https://github.com/tareq1988/wp-docker","last_synced_at":"2025-03-27T08:30:44.649Z","repository":{"id":141690683,"uuid":"114597275","full_name":"tareq1988/wp-docker","owner":"tareq1988","description":"A simple opinionated PHP 7.2 Docker \u0026 Compose Environment for WordPress","archived":false,"fork":false,"pushed_at":"2021-10-22T19:40:08.000Z","size":25,"stargazers_count":30,"open_issues_count":3,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T10:51:07.657Z","etag":null,"topics":["docker","docker-compose","maridb","nginx","php-fpm","redis","wordpress"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tareq1988.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-12-18T04:54:18.000Z","updated_at":"2025-02-13T06:54:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"0bbb2d88-7c30-4a88-8ecf-82614bea8122","html_url":"https://github.com/tareq1988/wp-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tareq1988%2Fwp-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tareq1988%2Fwp-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tareq1988%2Fwp-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tareq1988%2Fwp-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tareq1988","download_url":"https://codeload.github.com/tareq1988/wp-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245809626,"owners_count":20676024,"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","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-compose","maridb","nginx","php-fpm","redis","wordpress"],"created_at":"2024-10-30T12:13:50.067Z","updated_at":"2025-03-27T08:30:44.642Z","avatar_url":"https://github.com/tareq1988.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\nA simple *opinionated* PHP 7.4 Docker \u0026 Compose Environment for WordPress using Nginx, PHP-FPM, Redis, PHPMyAdmin, Composer, WP CLI and [Bedrock](https://github.com/roots/bedrock).\n\n\n## Images Used\n\n* [Nginx](https://hub.docker.com/_/nginx/) - Latest\n* [Mariadb](https://hub.docker.com/_/mariadb) - Latest\n* [PHP-FPM](https://hub.docker.com/_/php/) - Latest (with composer and wp-cli)\n* [PHPMyAdmin](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) - Latest\n* [Redis](https://hub.docker.com/_/redis/) - Latest\n\n\nThis project use the following ports :\n\n| Server     | Port |\n|------------|------|\n| MySQL      | 3306 |\n| PHPMyAdmin | 8081 |\n| Nginx      | 8080 |\n| Nginx SSL  | 3000 |\n| Redis      | 6379 |\n\n**PHP Extensions:**\ndate, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, pdo_sqlite, session, posix, readline, Reflection, standard, SimpleXML, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, cgi-fcgi, bcmath, exif, gd, imagick, mysqli, redis, sodium, zip\n\n## Install prerequisites\n\nFor now, this project has been mainly created for Unix `(Linux/MacOS)`. Perhaps it could work on Windows.\n\nAll requisites should be available for your distribution. The most important are :\n\n* [Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx)\n* [Git](https://git-scm.com/downloads)\n* [Docker](https://docs.docker.com/engine/installation/)\n* [Docker Compose](https://docs.docker.com/compose/install/)\n\n## Installation\n\n### Step 0: Clone Repository\n\nClone this repository in your preferred location.\n\n```sh\ngit clone https://github.com/tareq1988/wp-docker.git wordpress\ncd wordpress\n```\n\n### Step 1: Dependency Install\n\nCopy the `.env-example` file to `.env`. It contains the NGINX hostname and MySQL database credentials. After filling that up, run:\n\n```sh\nmake install\nmake install-plugins\n```\n\n### Step 2: WordPress Configuration\n\nThe above command will install the dependencies in place. To complete the WordPress installation, you've to configure the `/src/.env` file for to Bedrock use. Copy the `/src/.env.example` to `/src/.env` file and change the MySQL table and username as configured on the root `.env` file.\n\n**Important:** Set your `DB_HOST` to `mariadb` in the `/src/.env` file.\n\n**Site URL:**\nThe default WordPress site URL will be `http://wordpress.local:8080` which is defined in the root `.env` file as the Nginx Host `NGINX_HOST=wordpress.local`. If you change this to something else, make sure you also change this value in `/src/.env` file, the `WP_HOME` configuration (`WP_HOME=http://wordpress.local:8080`). The port name has to be appended.\n\n**Application Salt:**\nGenerate the salt [from the generator](https://roots.io/salts.html) and replace it on `/src/.env` file.\n\n**Configure Host File:**\nYou've to configure your `/etc/hosts` file to point the site URL to `127.0.0.1`. As we are using `http://wordpress.local` as our hostname, add this config in your `/etc/hosts` file.\n\n```sh\nsudo vi /etc/hosts\n```\n\nAdd config:\n\n```\n127.0.0.1\twordpress.local\n```\n\nNow save and exit.\n\n### Step 3: Run\n\nNow as all the configuration is done, run the docker instance.\n\n```sh\nmake docker-start\n```\n\nThis will simply run docker in detached mode with this command: `docker-compose up -d`\n\nGo to `http://wordpress.local:8080` in your browser and you should see the WordPress installation page.\n\n## WordPress Setup\n\nWe are using [Bedrock](https://github.com/roots/bedrock) as our WordPress starter kit.\n\nWhen using `make install` command, the required dependencies will be installed automatically. With the command `make install-plugins`, the following plugins will be installed as a composer dependency:\n\n- [Disable Emojis](http://wordpress.org/plugin/disable-emojis)\n- [Nginx Cache](http://wordpress.org/plugin/nginx-cache)\n- [Redis Cache](http://wordpress.org/plugin/redis-cache)\n- [Debug Bar](http://wordpress.org/plugin/debug-bar)\n- [Query Monitor](http://wordpress.org/plugin/query-monitor)\n\n**Page Cache:**\nBy default, we will be using **Nginx Fastcgi Cache** and the [Nginx Cache](http://wordpress.org/plugin/nginx-cache) plugin will be the helper to clear the cache. In the plugin settings, you have to save the path to `/var/run/nginx-cache` as the clear path.\n\nIf you don't want to use fastcgi cache, edit the `/conf/nginx/site.template.conf` and comment or remove the line `include global/wpfc-php.conf;` and uncomment `include global/php.conf;` file.\n\n**Object Cache:**\nWe will be using Redis as our persistant object cache backend. The [Redis Cache](http://wordpress.org/plugin/redis-cache) plugin will be used to conditionally clear out the redis cache storage. The command `make install-plugins` will automatically install the plugin and will put the `object-cache.php` in the required location (`/web/app/object-cache.php`).\n\nIn order to take the redis cache setup complete, you've to manually add this line `define('WP_REDIS_HOST', 'redis');` in the `/src/config/application.php` file.\n\n## Directory Structure\n\n```\n├── Makefile\n├── README.md\n├── conf\t\t\t\t\t# Nginx, PHP Configuration\n│   ├── mysql\n│   │   └── my.cnf\n│   ├── nginx\t\t\t\t\t\n│   │   ├── global/\n│   │   ├── nginx.conf\n│   │   └── site.template.conf\n│   └── php\n│       └── php.ini\n├── data\t\t\t\t\t# Persistant data directory\n│   ├── dumps/\n│   ├── logs/\n│   ├── mysql\n│   │   └── mariadb\n│   └── nginx-cache/\n├── docker-compose.yml\n└── src\t\t\t\t\t\t# Application Code\n    ├── CHANGELOG.md\n    ├── CODE_OF_CONDUCT.md\n    ├── LICENSE.md\n    ├── README.md\n    ├── composer.json\n    ├── composer.lock\n    ├── config\n    │   ├── application.php\t\t\t# Primary wp-config.php\n    │   └── environments\n    │       ├── development.php\n    │       ├── production.php\n    │       └── staging.php\n    ├── vendor\t\t\t\t\t# Composer dependencies\n    │   ├── autoload.php\n    │   ├── bin/\n    │   ├── composer/\n    │   ├── johnpbloch/\n    │   ├── oscarotero/\n    │   ├── roots/\n    │   ├── squizlabs/\n    │   └── vlucas/\n    ├── web\n    │   ├── app/\t\t\t\t# WordPress content directory\n    │   ├── index.php\n    │   ├── wp/\t\t\t\t\t# WordPress core\n    │   └── wp-config.php\n    └── wp-cli.yml\n```\n\n\n## Use Makefile\n\nWhen developing, you can use [Makefile](https://en.wikipedia.org/wiki/Make_(software)) for doing the following operations :\n\n| Name          | Description                                |\n|---------------|--------------------------------------------|\n| install       | Run docker build and install bedrock       |\n| install-plugins| Install the required WP plugins           | \n| clean         | Clean directories for reset                |\n| docker-start  | Create and start containers                |\n| docker-stop   | Stop and clear all services                |\n| logs          | Follow log output                          |\n| mysql-dump    | Create backup of whole database            |\n| mysql-restore | Restore backup from whole database         |\n\n### Examples\n\nStart the application :\n\n```sh\nmake docker-start\n```\n\nShow help :\n\n```sh\nmake help\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftareq1988%2Fwp-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftareq1988%2Fwp-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftareq1988%2Fwp-docker/lists"}