Skip to content

Instantly share code, notes, and snippets.

@pjaudiomv
Created February 10, 2026 18:17
Show Gist options
  • Select an option

  • Save pjaudiomv/f4eb4e7547eb9a45cf84dab973ec707d to your computer and use it in GitHub Desktop.

Select an option

Save pjaudiomv/f4eb4e7547eb9a45cf84dab973ec707d to your computer and use it in GitHub Desktop.
Wordpress Docker Compose
services:
wordpress:
depends_on:
- db
build: .
restart: always
ports:
- 8080:80
- 7443:443
environment:
WORDPRESS_DEBUG: true
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
# Mount the entire public_html directory as the WordPress root
- ./site:/var/www/html
# Separate logs directory
- ./logs/:/var/log/apache2
db:
image: mariadb:10.11
restart: always
ports:
- 3306:3306
environment:
MARIADB_ROOT_PASSWORD: somewordpress
MARIADB_DATABASE: wordpress
MARIADB_USER: wordpress
MARIADB_PASSWORD: wordpress
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/001-init.sql
- db_data:/var/lib/mysql
volumes:
db_data:
@pjaudiomv

Copy link
Copy Markdown
Author
FROM wordpress:6.9.4-php8.3-apache
RUN apt-get update && \
	apt-get install -y  --no-install-recommends ssl-cert && \
	rm -r /var/lib/apt/lists/* && \
	a2enmod ssl rewrite expires && \
	a2ensite default-ssl

ENV PHP_INI_PATH "/usr/local/etc/php/php.ini"

RUN pecl install xdebug-3.5.1 && docker-php-ext-enable xdebug \
    && echo "xdebug.mode=debug" >> ${PHP_INI_PATH} \
    && echo "xdebug.client_port=9003" >> ${PHP_INI_PATH} \
    && echo "xdebug.client_host=host.docker.internal" >> ${PHP_INI_PATH} \
    && echo "xdebug.start_with_request=yes" >> ${PHP_INI_PATH} \
    && echo "xdebug.log=/tmp/xdebug.log" >> ${PHP_INI_PATH} \
    && echo "xdebug.idekey=IDE_DEBUG" >> ${PHP_INI_PATH}

EXPOSE 80
EXPOSE 443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment