Skip to content

yohannTum/WordpressDockerCompose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local WordPress Docker Compose (WP Migrate)

Quick links: Features | Installation | Usage | Contributing | Credits | Roadmap

Easily set up a local development environment that mirrors your existing WordPress site exported with the wp-migrate-db plugin using Docker and Docker Compose.

Table of contents

Features

  • Docker and Docker compose
  • WP-Cli support
  • Easy setup with wp-migrate-db plugin
  • Wordpress and PHP versions and wp cli are installed manually (you can install specific versions if you can't find the correct tag at wordpress docker hub). You only need to set it up in the .env file
  • Custom wordpress entrypoint script (with wp-cli commands)
  • Apache2 for wordpress setup
  • Mysql for database setup
  • phpmyadmin and adminer interface to interact with your database

Prerequisites

Make sure you have the latest versions of Docker and Docker Compose installed on your machine.

  • Docker and Docker Compose installed
  • make
  • zip/unzip
  • git

Installation

  1. Install on your wordpress website the plugin named 'wp migrate lite' and export your website
  2. Clone/Download the project
  3. Place the zip file in the zip/ folder
  4. Copy the example environment into .env
cp .env.example .env
  1. Edit the .env file to change the default environment variables
  2. A Makefile will help you to place files at the right place in your project
make

Usage

Open a terminal and cd to the folder in which docker-compose.yml is saved and run :

docker compose up # use option '-d' for daemon mode

You can now access your site at http://localhost:3000 and the admin panel at http://localhost:3000/wp-admin (port 3000 by default in env).

To access your database, you can use adminer at http://localhost:8080 or phpmyadmin at http://localhost:8081.

Stop your running containers

docker compose down

Start from original database

Your wordpress database is persistent even after shutting down your containers, if you want to start from the original database you exported from wp migrate plugin, you need to delete the database folder and restart your docker containers with docker compose.

sudo rm -r database

Cleaning build files

make clean

Debugging

To see the build process in plain text for a specific image :

BUILDKIT_PROGRESS=plain docker compose up -d --no-deps --build wordpress

Inspecting your running db container health command (requires jq program ):

docker inspect db | jq '.[0].State.Health'

Contributing

Feel free to open an issue in this github repository if you have any questions or want to see a feature implemented first.

Credits

Roadmap

The idea of this project would be to make it a general docker-compose for wordpress, extend other configurations (nginx, mariadb...) and support other wordpress plugins that helps you migrate/backup your website for a local development environment with docker.

  • Export db dump script
  • Support nginx configuration
  • Support mariadb (healthcheck, Dockerfile...)
  • Redis cache?
  • Https for local development (ssl certification)
  • Add wp-cli bash completion, run wp-cli without root
  • Themes development + update
  • Custom php config (php.ini)
  • Start as a new wordpress project
  • Git wordpress versionning?
  • WP Migrate : load docker compose config from wpmigrate-export.json?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published