adzay / wordpress-docker-compose

Docker environment for local Wordpress development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prerequisites

You need Docker to be installed with docker-compose.

Also, a WordPress backup plugin is needed. The plugin should download the database dump in SQL format and all necessary WordPress files.

I tested it with backwpup plugin. With this plugin, you need to create a cron-job to generate backup files. Run job and download results.

Configuration

Clone this repository to the desired folder using the command below.

git clone git@github.com:bogkonstantin/wordpress-docker.git

Change PHP version in docker/php/Dockerfile if needed. Change MySQL version in docker-compose.yml if needed.

Copy website files to the wp folder.

Add to wp-config.php local database connection values. See it in the docker-compose.yml or override using the .env file.

Default parameters:

define( 'DB_NAME', "db" );
define( 'DB_USER', "dbuser" );
define( 'DB_PASSWORD', "pass" );
define( 'DB_HOST', "db" );

Set domain to localhost in wp-config.php:

define('WP_HOME','http://localhost');
define('WP_SITEURL','http://localhost');

Copy database dump to db_init folder.

Override config values in .env files if needed. See the list of available variables in the docker-compose.yml file.

Usage

Use it with docker-compose commands. For example, start the application with the command:

docker-compose up -d

Stop application (containers) with the command:

docker-compose down

Now you can open your website locally using the link http://localhost

Config Xdebug in your IDE if necessary.

Other

Feel free to contribute to this repository.

And don't forget to check your website availability with uptime.onl.

About

Docker environment for local Wordpress development


Languages

Language:Dockerfile 56.5%Language:Shell 43.5%