Skip to content

moveyourdigital/wp-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wp-docker-compose

A Docker Compose development environment for WordPress plugin and theme development.

Features

  • WordPress with PHP 8.2
  • MySQL 8 database
  • Adminer for database management
  • Fake SMTP server for email testing
  • Debug logging enabled by default
  • Increased upload limits (64MB)

Prerequisites

  • Docker
  • Docker Compose

Setup

  1. Copy the environment file:

    cp .env.example .env

    Update .env changing defaults.

  2. Start the containers:

    docker compose up
  3. Access WordPress at http://wp-docker.localhost (or your configured host and port)

Configuration

Configure the environment via .env:

Variable Default Description
WP_HOST wp-docker.localhost WordPress hostname
WP_PORT 80 WordPress port
WP_DEBUG true Enable WordPress debug mode
ADMINER_PORT 8081 Adminer port
SMTP_HTTP_PORT 8082 Fake SMTP web interface port

Services

Service URL Description
WordPress http://${WP_HOST}:${WP_PORT} Main WordPress site
Adminer http://localhost:${ADMINER_PORT} Database management UI
Fake SMTP http://localhost:${SMTP_HTTP_PORT} View sent emails

Database Credentials

  • Host: db
  • Database: exampledb
  • User: exampleuser
  • Password: examplepass

Directory Structure

The wp-content/ directory is mounted to the host for development:

wp-content/
├── mu-plugins/    # Must-use plugins
├── plugins/       # Regular plugins
└── themes/        # Themes

Git Configuration

The .gitignore is configured to ignore all files in wp-content/ except for:

  • wp-content/object-cache.php
  • wp-content/mu-plugins/autoload.php

To un-ignore a file inside a subdirectory, you must first un-ignore the parent directory, then re-ignore its contents, then un-ignore the specific file:

# Ignore everything in wp-content
wp-content/*

# Un-ignore a file directly in wp-content
!wp-content/object-cache.php

# Un-ignore a file in a subdirectory
!wp-content/mu-plugins/
wp-content/mu-plugins/*
!wp-content/mu-plugins/autoload.php

About

Simple WordPress Docker Compose recipe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages