Skip to content

mfdeveloper/wordpress-docker-compose

Repository files navigation

Wordpress Docker Compose

Inspired by lyzs90/vuewp repository structure, this is a Docker Compose project with config files, scripts and automations to run and deploy wordpress project. Using this, any theme (including SPA themes) needs be a separated repository, or a composer dependency.

Features

  • Docker for a deterministic and easy to set up development environment
  • Composer for install wp plugins/themes and others PHP libraries, and run phpunit tests. The command is installed in wordpress-tools docker image
  • Custom shell scripts for wordpress-tools image commands, similar to Docker aliases
  • PHPUNIT for unit/integration wordpress plugin tests
  • PHPCS to detect violations of a defined coding standard.
  • WP-CLI A command-line tool to wordpress management

Usage

  • Set up a Docker and Docker Compose environment
  • Clone this repo git clone https://github.com/mfdeveloper/docker-images.git
  • Copy the script aliases from ./docker-aliases to any folder of your $PATH environment variable (e.g ~/.docker/aliases)
  • Install the dependencies composer install
  • Start Wordpress and MySQL docker-compose up -d wordpress db
  • Add your container ip (e.g localhost) to .env.example and rename to .env (or change the .env directly)
  • Access the Wordpress server at this url http://<CONTAINER_IP>:8000 and perform the famous 5-minute install
  • Enjoy it!

Mysql backup

Into ./db-backup directory, you can backup/restore all databases

  • dumpSql(): Generate a mysql.databases.sql file with all databases

Usage: dumpSql wordpress-docker-compose_1

  • restoreSql(): Restore a mysql.databases.sql file into mysql db service

Usage: restoreSql wordpress-docker-compose_1

  • dumpFolder(): Generate a mysql.databases.tar.gz compressed file with all databases

Usage: dumpSql wordpress-docker-compose_1

  • restoreFolder(): Restore a mysql.databases.sql file into mysql db service

Usage: restoreSql wordpress-docker-compose_1

Plugins

Unit test

These scripts are used to configure/run phpunit tests of one or more wordpress plugins.

PS: For run the commands below, you need stay on this root project folder, relative to composer.json file:

  • addTestFiles: Run wp scaffold plugin-tests with wp-cli to generate files to configure tests

Usage: composer addTestFiles --plugin <my-wp-plugin>

  • installWpTests: Run install-wp-tests.sh file, to create wordpress_test database for tests

Usage: composer installWpTests

  • test: Run tests of a wordpress plugin. Use --plugin argument to pass a plugin name

Usage: composer test -- --plugin <my-wp-plugin>

Credits

License

The MIT License (MIT)

TODO

  • A custom composer script to download a .zip file language-pack by
    the current wp language, and store the .mo and .po file in wp-content/languages/plugins/

About

A wordpress docker services stack with composer + scripts for automation development and CI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy