{"id":17727764,"url":"https://github.com/samk-dev/docker-wp","last_synced_at":"2025-03-31T15:53:36.555Z","repository":{"id":116423164,"uuid":"380541295","full_name":"samk-dev/docker-wp","owner":"samk-dev","description":"Local development environment for WordPress with Docker \u0026\u0026 Docker Compose","archived":false,"fork":false,"pushed_at":"2021-10-17T19:12:57.000Z","size":15743,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-27T02:08:29.194Z","etag":null,"topics":["docker","docker-compose","lemp-stack","mailhog","ngnix","php-fpm","phpmyadmin","portainer","ssl-support","wordpress"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/samk-dev.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":"2021-06-26T15:59:38.000Z","updated_at":"2021-06-29T13:56:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"cab0ad07-157c-4142-8977-2b0016c608e6","html_url":"https://github.com/samk-dev/docker-wp","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/samk-dev%2Fdocker-wp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samk-dev%2Fdocker-wp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samk-dev%2Fdocker-wp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samk-dev%2Fdocker-wp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samk-dev","download_url":"https://codeload.github.com/samk-dev/docker-wp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246492099,"owners_count":20786302,"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","lemp-stack","mailhog","ngnix","php-fpm","phpmyadmin","portainer","ssl-support","wordpress"],"created_at":"2024-10-25T18:22:26.045Z","updated_at":"2025-03-31T15:53:36.525Z","avatar_url":"https://github.com/samk-dev.png","language":"Dockerfile","readme":"# Docker WP\n\n**⚠️ still work in progress ⚠️**\n\nLocal development setup for WordPress using Docker \u0026\u0026 Docker Compose with Nginx - PHP-FPM - MySql - PHP MyAdmin - Mailhog - Self-Signed SSL Certificates\n\n## Getting Started\n\nWe should set our enviornment variables and generate our self-signed ssl certificates. _If you don't want to enable ssl certificates please comment or remove the follwoing code to avoid errors. `docker-compose.yml` lines: 13 and 18 - `etc/config/nginx.conf` lines: 83 to the end of file_\n\nWe adjust the variables in .env to suite our project the default ports are:\n\n-   Ngnix Http: 80\n-   Ngnix Https: 443\n-   PHP-FPM: 9001\n-   NodeJS: 3000\n-   MySql: 3306\n-   PHP MyAdmin: 8080\n-   Mailhog Server: 1025\n-   Mailhog UI: 8025\n-   Portainer: 8000\n\n### Preparing Stuff\n\n```bash\n# Clone the repository\ngit clone git@github.com:samk-dev/docker-wp.git\n\n# Navigate to docker-wp\ncd docker-wp\n\n# Rename .env-example to .env\nmv .env-example .env\n\n## Generate Self-Signed SSL Certificate ##\n## This is not required if you don't need https and you did comment/remove the ssl settings ##\n\n# Give excution permissions to the script\nchmod u+x chmod u+x etc/scripts/self-signed-init.sh\n\n# Execute the script\n./etc/scripts/self-signed-init.sh localhost\n```\n\n### Starting Up Containers\n\nfrom the project root run `docker-compose up -d` this will build and run the containers. Prepare yourself a ☕️ because it will take some time\n\n**From any web browser access:**\n\n-   Webserver HTTP - [http://localhost:${PORT_NGINX}](http://localhost)\n-   Webserver HTTPS - [https://localhost:${PORT_NGINX}](https://localhost) - you may get a broswer alert of an insecure content, just press proceed anyway. On chrome sometimes you may not see the proceed button anyway, you can find a fix here: [Bypass invalid certificate in chrome - NET::ERR_CERT_INVALID error](https://dblazeski.medium.com/chrome-bypass-net-err-cert-invalid-for-development-daefae43eb12)\n-   PHP MyAdmin - [http://localhost:${PORT_PHP_MYADMIN}](http://localhost:8080)\n-   Mailhog - [http://localhost:${PORT_MAILHOG_UI}](http://localhost:8025)\n-   Portainer - [http://localhost:${PORT_MAILHOG_UI}](http://localhost:8025)\n\n## Connect to the Database\n\nThe variables refrenced in the examples are the values you set in .env @ project root\n\n### wp-config.php\n\n_When running `docker-compose up` the first install will already fill the db credentials for you, so if you want to modify change the wp-config settings_\n\n_When installing WordPress set the email as: **dev@mailhog.local**_\n\n```php\n/** MySQL settings - You can get this info from your web host **/\n\n/** The name of the database for WordPress */\ndefine( 'DB_NAME', $MYSQL_DATABASE );\n\n/** MySQL database username */\ndefine( 'DB_USER', $MYSQL_ROOT_USER );\n\n/** MySQL database password */\ndefine( 'DB_PASSWORD', $MYSQL_ROOT_PASSWORD );\n\n/** MySQL hostname */\ndefine( 'DB_HOST', '\u003ccontainer_name\u003e:\u003ccontainer_port\u003e' );\n\n/** Database Charset to use in creating database tables. */\ndefine( 'DB_CHARSET', 'utf8' );\n\n/** The Database Collate type. Don't change this if in doubt. */\ndefine( 'DB_COLLATE', '' );\n```\n\n### Connect to the Database using PHP MyAdmin\n\n-   Server: mysql:${PORT_MYSQL}\n-   Username: ${MYSQL_ROOT_USER}\n-   Password: ${MYSQL_ROOT_PASSWORD}\n\n### Connect to the Database using database clients like Table Plus\n\n-   Host: 127.0.0.1\n-   Port: ${PORT_MYSQL}\n-   Database: ${MYSQL_DATABASE}\n-   User: ${MYSQL_ROOT_USER}\n-   Password: ${MYSQL_ROOT_PASSWORD}\n\n## Access containers shell:\n\nYou can access any container shell by using the command `docker exec -it ${CONTAINER_NAME} sh` and `exit` to exit\n\n_Example by installing [Sage 10 Starter Theme by the guys @ root.io](https://roots.io/sage/):_\n\n```bash\n# Access WP container\ndocker exec -it docker-wp-dev sh\n\n# Navigate to wp-content/themes\ncd wp-content/themes\n\n# Install Sage\ncomposer create-project roots/sage your-theme-name dev-master\n\n# Navigate to your-theme-name\ncd your-theme-name\n\n# Install all the necessary dependencies to run the build process\nyarn\n# OR\nnpm install\n```\n\n**⚠️ HMR is not working ... working on a fix ⚠️**\n\n### Mailhog Configuration\n\n-   Install [WordPress Mail SMTP Plugin](https://wordpress.org/plugins/wp-mail-smtp/)\n-   Navigate to WP Mail SMTP \u003e Settings and Select PHP as mailer option\n-   Navigate to WP Mail SMTP \u003e Tools \u003e Email Test\n    in Send To set the address to `dev@mailhog.local` as a result you'de see a warning, ignore it and check mailhog to see the email\n\n### Xdebug Configuration\n\n-   Inside `etc/config/wordpress.ini` change `xdebug.remote_host` to your local machine ip address\n-   Restart appserver container `docker restart appserver` _if you changed the service name make sure to refrence it instead of appserver_\n-   From php/wp container shell run `php -i | grep Xdebug` you should see xdebug version ++ more information\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamk-dev%2Fdocker-wp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamk-dev%2Fdocker-wp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamk-dev%2Fdocker-wp/lists"}