Skip to content

Instantly share code, notes, and snippets.

@easterncoder
Created March 17, 2023 16:03
Show Gist options
  • Save easterncoder/21fd5b02e147a4387887eabff35a81a1 to your computer and use it in GitHub Desktop.
Save easterncoder/21fd5b02e147a4387887eabff35a81a1 to your computer and use it in GitHub Desktop.
WordPress Quick Setup with docker-compose.yml
# Quick WordPress setup with Docker Compose. Includes wp-c
# By: Mike Lopez <e@mikelopez.com>
#
# Use .env file to change configuration variables.
# Configuration variables and their default values are:
# MYSQL_ROOT_PASSWORD=mysql_root_password_123
# UID=1000
# GID=1000
# PORT=80
# DBNAME=wordpress
# DBUSER=wordpress
# DBPASS=wordpress
# WPTAG=latest
services:
db:
# We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password'
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-mysql_root_password_123}
MYSQL_DATABASE: ${DBNAME:-wordpress}
MYSQL_USER: ${DBUSER:-wordpress}
MYSQL_PASSWORD: ${DBPASS:-wordpress}
expose:
- 3306
- 33060
wordpress:
user: ${UID:-1000}:${GID:-1000}
image: wordpress:${WPTAG:-latest}
volumes:
- wp_data:/var/www/html
ports:
- ${PORT:-80}:80
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${DBNAME:-wordpress}
WORDPRESS_DB_USER: ${DBUSER:-wordpress}
WORDPRESS_DB_PASSWORD: ${DBPASS:-wordpress}
wpcli:
user: ${UID:-1000}:${GID:-1000}
depends_on:
- wordpress
image: wordpress:cli
command: tail -f /dev/null
volumes:
- wp_data:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${DBPASS:-wordpress}
WORDPRESS_DB_USER: ${DBNAME:-wordpress}
WORDPRESS_DB_PASSWORD: ${DBUSER:-wordpress}
volumes:
db_data:
wp_data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment