2026-02-03 18:27:33 +01:00
|
|
|
# WordPress Docker Image
|
|
|
|
|
|
|
|
|
|
Custom WordPress Docker image with Redis and APCu extensions for object caching.
|
|
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
|
|
- Based on official `wordpress:php8.4` image
|
|
|
|
|
- Redis extension for external object caching
|
|
|
|
|
- APCu extension for in-memory caching
|
2026-02-03 19:47:30 +01:00
|
|
|
- WP-CLI pre-installed for command-line WordPress management
|
2026-02-03 18:27:33 +01:00
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
### Pull from Registry
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker pull your-registry.com/wordpress:latest
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Build Locally
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker build -t wordpress-custom .
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Run
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker run -d \
|
|
|
|
|
-p 8080:80 \
|
|
|
|
|
-e WORDPRESS_DB_HOST=db \
|
|
|
|
|
-e WORDPRESS_DB_USER=wordpress \
|
|
|
|
|
-e WORDPRESS_DB_PASSWORD=secret \
|
|
|
|
|
-e WORDPRESS_DB_NAME=wordpress \
|
|
|
|
|
wordpress-custom
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Docker Compose Example
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
services:
|
|
|
|
|
wordpress:
|
|
|
|
|
build: .
|
|
|
|
|
ports:
|
|
|
|
|
- "8080:80"
|
|
|
|
|
environment:
|
|
|
|
|
WORDPRESS_DB_HOST: db
|
|
|
|
|
WORDPRESS_DB_USER: wordpress
|
|
|
|
|
WORDPRESS_DB_PASSWORD: secret
|
|
|
|
|
WORDPRESS_DB_NAME: wordpress
|
|
|
|
|
depends_on:
|
|
|
|
|
- db
|
|
|
|
|
- redis
|
|
|
|
|
|
|
|
|
|
db:
|
|
|
|
|
image: mariadb:11
|
|
|
|
|
environment:
|
|
|
|
|
MYSQL_ROOT_PASSWORD: root
|
|
|
|
|
MYSQL_DATABASE: wordpress
|
|
|
|
|
MYSQL_USER: wordpress
|
|
|
|
|
MYSQL_PASSWORD: secret
|
|
|
|
|
|
|
|
|
|
redis:
|
|
|
|
|
image: redis:7-alpine
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Build Arguments
|
|
|
|
|
|
|
|
|
|
| Argument | Default | Description |
|
|
|
|
|
| ------------- | ------- | ------------------ |
|
|
|
|
|
| `PHP_VERSION` | `8.4` | PHP version to use |
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker build --build-arg PHP_VERSION=8.3 -t wordpress-custom .
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## CI/CD
|
|
|
|
|
|
|
|
|
|
This repository includes a Gitea Actions workflow that automatically builds and pushes the image.
|
|
|
|
|
|
|
|
|
|
### Required Secrets
|
|
|
|
|
|
|
|
|
|
| Secret | Description |
|
|
|
|
|
| ------------------- | --------------------------------- |
|
|
|
|
|
| `REGISTRY_USERNAME` | Container registry username |
|
|
|
|
|
| `REGISTRY_PASSWORD` | Container registry password/token |
|
|
|
|
|
|
|
|
|
|
### Optional Variables
|
|
|
|
|
|
|
|
|
|
| Variable | Default | Description |
|
|
|
|
|
| ------------ | ------------------- | ---------------------- |
|
|
|
|
|
| `REGISTRY` | `gitea.example.com` | Container registry URL |
|
|
|
|
|
| `IMAGE_NAME` | Repository name | Custom image name |
|
|
|
|
|
|
|
|
|
|
### Trigger Events
|
|
|
|
|
|
|
|
|
|
- Push to `main` or `master` branch
|
|
|
|
|
- Version tags (`v*`)
|
|
|
|
|
- Pull requests (build only, no push)
|