This repository contains a custom Docker image based on the official WordPress 6.8.2-php8.4-apache image with Memcached PHP modules pre-installed.
- Base Image:
wordpress:6.8.2-php8.4-apache
- Memcached Support: PHP Memcached extension for caching and session management
- Optimized: Includes OPcache configuration for better performance
- Multi-platform: Built for both AMD64 and ARM64 architectures
- BuildKit Optimized: Multi-stage builds with build cache optimization
- Production Ready: Minimal runtime image size with health checks
Create a docker-compose.yml
file:
version: '3.8'
services:
wordpress:
image: ghcr.io/reclaimergold/ftg-wordpress:latest
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
- wordpress_data:/var/www/html
depends_on:
- db
- memcached
db:
image: mysql:8.0
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_ROOT_PASSWORD: somewordpress
volumes:
- db_data:/var/lib/mysql
memcached:
image: memcached:latest
volumes:
- wordpress_data:/var/www/html
volumes:
wordpress_data:
db_data:
# Start Memcached
docker run -d --name memcached memcached:latest
# Start MySQL
docker run -d --name mysql \
-e MYSQL_ROOT_PASSWORD=somewordpress \
-e MYSQL_DATABASE=wordpress \
-e MYSQL_USER=wordpress \
-e MYSQL_PASSWORD=wordpress \
mysql:8.0
# Start WordPress with Memcached
docker run -d --name wordpress \
--link mysql:mysql \
--link memcached:memcached \
-p 8080:80 \
-e WORDPRESS_DB_HOST=mysql \
-e WORDPRESS_DB_USER=wordpress \
-e WORDPRESS_DB_PASSWORD=wordpress \
-e WORDPRESS_DB_NAME=wordpress \
ghcr.io/ReclaimerGold/ftg-wordpress:latest
Ensure Docker BuildKit is enabled for optimal build performance:
# Enable BuildKit for current session
export DOCKER_BUILDKIT=1
# Or enable BuildKit permanently in Docker daemon configuration
# Add to ~/.docker/daemon.json:
# {
# "features": {
# "buildkit": true
# }
# }
# Clone this repository
git clone https://github.com/reclaimergold/ftg-wordpress.git
cd ftg-wordpress
# Build using BuildKit (recommended)
DOCKER_BUILDKIT=1 docker build -t ftg-wordpress:local .
# Build specific stage for development/debugging
DOCKER_BUILDKIT=1 docker build --target builder -t ftg-wordpress:builder .
DOCKER_BUILDKIT=1 docker build --target runtime -t ftg-wordpress:local .
# Build with build arguments and cache optimization
DOCKER_BUILDKIT=1 docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from ftg-wordpress:latest \
-t ftg-wordpress:local .
# Run locally built image
docker run -d -p 8080:80 ftg-wordpress:local
- Multi-stage builds: Separate builder and runtime stages for smaller final image
- Build cache mounts: Faster rebuilds with persistent package caches
- Parallel stage execution: Builder and runtime dependency installation run concurrently
- Optimized layer caching: Enhanced Docker layer caching for faster subsequent builds
To use Memcached with WordPress, you'll need to install a Memcached caching plugin or configure WordPress to use Memcached for object caching. Here are some options:
- Install the "W3 Total Cache" plugin from the WordPress admin
- Configure it to use Memcached as the caching method
- Set the Memcached server to
memcached:11211
- Install the "Memcached Object Cache" plugin from the WordPress admin
- Add the following to your
wp-config.php
:
$memcached_servers = array(
array('memcached', 11211)
);
Add an object-cache.php
file to your wp-content
directory or use a Memcached caching plugin.
The image supports all standard WordPress environment variables:
WORDPRESS_DB_HOST
- Database hostnameWORDPRESS_DB_USER
- Database usernameWORDPRESS_DB_PASSWORD
- Database passwordWORDPRESS_DB_NAME
- Database nameWORDPRESS_TABLE_PREFIX
- Database table prefix (default: wp_)
This repository includes a GitHub Actions workflow that automatically:
- Builds the Docker image using BuildKit when a version tag is created (e.g.,
v1.0.0
) - Publishes to GitHub Container Registry (ghcr.io)
- Creates multi-platform builds (AMD64 and ARM64) with BuildKit
- Uses build cache optimization for faster CI/CD builds
- Tags images with semantic versioning (e.g.,
v1.0.0
,1.0
,1
,latest
)
- Fork or create this repository on GitHub
- Enable GitHub Actions in your repository settings
- Create a version tag to trigger the first build:
git tag v1.0.0 git push origin v1.0.0
The workflow will automatically publish your image to ghcr.io/ReclaimerGold/ftg-wordpress:latest
and version-specific tags.
This Docker image leverages BuildKit for enhanced build performance:
- Faster Builds: Build cache mounts reduce rebuild times by up to 80%
- Smaller Images: Multi-stage builds eliminate build dependencies from final image (14MB smaller)
- Parallel Execution: Multiple stages can build concurrently
- Advanced Caching: Shared caches across builds and CI/CD pipelines
- Better Security: Minimal attack surface in production image
If you encounter BuildKit-related issues:
# Check if BuildKit is enabled
docker version --format '{{.Client.Experimental}}'
# Disable BuildKit if needed
DOCKER_BUILDKIT=0 docker build -t ftg-wordpress:local .
# Clear BuildKit cache if builds fail
docker builder prune -a
- Memcached: For Memcached connectivity and caching
- OPcache: For PHP bytecode caching and performance
- All standard WordPress extensions from the base image
This project is licensed under the MIT License - see the LICENSE file for details.