tiredofit / docker-wordpress

Dockerized Content Management System many with customizable options
MIT License
36 stars 7 forks source link
wordpress

github.com/tiredofit/docker-wordpress

GitHub release Build Status Docker Stars Docker Pulls Become a sponsor Paypal Donate

About

This will build a Docker Image for Wordpress. A web based content management system. It will:

Maintainer

Table of Contents

Prerequisites and Assumptions

Installation

Build from Source

Clone this repository and build the image with docker build <arguments> (imagename) .

Prebuilt Images

Builds of the image are available on Docker Hub

docker pull docker.io/tiredofit/wordpress:(imagetag)

Builds of the image are also available on the Github Container Registry

docker pull ghcr.io/tiredofit/docker-wordpress:(imagetag)

The following image tags are available along with their tagged release based on what's written in the Changelog:

PHP version OS Tag
8.3.x Alpine :php-8.3
8.2.x Alpine :php-8.2
8.1.x Alpine :php-8.1
8.0.x Alpine :php-8.0
7.4.x Alpine :php-7.4
7.3.x Alpine :php-7.3
7.2.x Alpine :php-7.2
7.1.x Alpine :php-7.1
7.0.x Alpine :php-7.0
5.6.x Alpine :php5.6

Multi Architecture

Images are built primarily for amd64 architecture, and may also include builds for arm/v7, arm64 and others. These variants are all unsupported. Consider sponsoring my work so that I can work with various hardware. To see if this image supports multiple architecures, type docker manifest (image):(tag)

Configuration

Quick Start

Persistent Storage

The following directories are used for configuration and can be mapped for persistent storage.

Directory Description
/www/wordpress Root Wordpress Directory
/www/logs Nginx and php-fpm logfiles

Environment Variables

Base Images used

This image relies on an Alpine Linux base image that relies on an init system for added capabilities. Outgoing SMTP capabilities are handlded via msmtp. Individual container performance monitoring is performed by zabbix-agent. Additional tools include: bash,curl,less,logrotate,nano.

Be sure to view the following repositories to understand all the customizable options:

Image Description
OS Base Customized Image based on Alpine Linux
Nginx Nginx webserver
PHP-FPM PHP Interpreter
Parameter Description Default _FILE
ADMIN_EMAIL Email address for the Administrator - Needed for initial startup x
ADMIN_USER Username for the Administrator - Needed for initial startup admin x
ADMIN_PASS Password for the Administrator - Needed for initial startup x
ENABLE_HTTPS_REVERSE_PROXY Tweak nginx to run behind a reverse proxy for URLs TRUE / FALSE TRUE
DB_CHARSET MariaDB character set for tables utf8mb4
DB_HOST MariaDB external container hostname (e.g. wordpress-db) x
DB_NAME MariaDB database name i.e. (e.g. wordpress) x
DB_USER MariaDB username for database (e.g. wordpress) x
DB_PASS MariaDB password for database (e.g. userpassword) x
DB_PORT MariaDB port for database 3306 x
DB_PREFIX MariaDB Prefix for DB_NAME wp_ x
DEBUG_MODE Enable Debug Mode (verbosity) for the container installation/startup and in application - TRUE / FALSE FALSE
ROTATE_KEYS Rotate Salts and Keys on subsequent reboots TRUE / FALSE FALSE
SITE_LOCALE What Locale to set site en_US
SITE_PORT What Port does wordpress deliver assets to 80
SITE_TITLE The title of the Website Docker Wordpress
SITE_URL The Full site URL of the installation e.g. wordpress.example.com - Needed for initial startup
SITE_URL_UPDATE_MODE After first install, perform modifications to wp-config.php and DB if different Site URL FILE DB ALL NONE ALL
UPDATE_MODE ALL to enable all major, minor updates, MINOR to only allow minor updates NONE to disable all updates minor

Networking

The following ports are exposed.

Port Description
80 HTTP

Maintenance

Shell Access

For debugging and maintenance purposes you may want access the containers shell.

docker exec -it (whatever your container name is) bash

Local Development / Changing Site Name & Ports

Wordpress assets are delivered by means of the initial Site URL, and if you wish to develop locally or on a different port you will experience strange results. If you are performing local development then you would want to setup your environment variables as such:

When you are ready to deploy to a production URL - you would change it as such:

The system will rotate the URLs in the wordpress configuration files and database automatically upon restart of the container.

Command Line

If you wish to use the included wp-cli tool to perform maintenance use it as such:

cd /www/wordpress
wp-cli <argument>

Support

These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community.

Usage

Feature Requests

Updates

License

MIT. See LICENSE for more details.

Maintenance

Shell Access

For debugging and maintenance purposes you may want access the containers shell.

docker exec -it (whatever your container name is e.g. wordpress) bash

References