Quickly creates a local development environment for an existing WordPress site.
This application requires Docker to be up and running and for docker compose to also be installed.
The docker-compose.yml file defines 2 containers -
wordpress- for the website files.db- for the associated MySQL database.
The wordpress container has 2 volumes -
-
The
site/wp-contentfolder - Copy thewp-contentfolder from the production site. It's used for all customisations outside of the core WordPress code. This includes the themes, plugins, uploads etc. -
init/prep.sh- Disables plugins as defined in the.envfile. It also makes thewp-contentfolder the same owner/group as the rest of the site.
Note: The wp-config.php file gets auto generated for this local WordPress instance.
The db container has 3 volumes -
-
database- A folder for all of the MySQL files, this gets automatically generated by docker and can remain untouched for average usage. -
mysqldumps/backup.sql.gz- This is a snapshot taken from the production instance via mysqldump, place the file in this location and it will get imported on the first run of the container automatically. -
init/migrate.sh- A URL migration script, this updates the URL stored in the database, this also gets run automatically when the containers are spun up for the first time.
-
Clone or download this project.
-
Create a mysqldump from your pre-existing site and place in location:
mysqldumps/backup.sql.gz(ensure file is namedbackup.sql.gz) -
Obtain copy of
wp-contentfolder from pre-existing site and place in location:site/wp-content -
Enter your configuration variables into
.env. -
Navigate to the root of this project locally and run:
docker-compose up -d && docker-compose exec wordpress prep.sh
The website will then be available at http://localhost and the WordPress dashboard at http://localhost/wp-admin.