Skip to content

Instantly share code, notes, and snippets.

@shanebp
Last active April 27, 2019 13:32
Show Gist options
  • Save shanebp/f9e40136e8660c8fed8acab50d54a6c2 to your computer and use it in GitHub Desktop.
Save shanebp/f9e40136e8660c8fed8acab50d54a6c2 to your computer and use it in GitHub Desktop.
docker compose WordPress linux
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:5.1.1-php7.3-apache
ports:
- "9210:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
working_dir: /var/www/html
volumes:
- ~/wordpress/wp_html:/var/www/html
- ~/wordpress/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
phpmyadmin:
image: corbinu/docker-phpmyadmin
links:
- db:mysql
ports:
- 9211:80
environment:
MYSQL_USERNAME: wordpress
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_PORT_3306_TCP_ADDR: db
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025 # smtp server
- 8025:8025 # web ui
volumes:
db_data:
<?php
/*
* put in your theme/functions file
* or in plugins/bp-custom.php if you are using BuddyPress
*/
function mailhog_setup( PHPMailer $phpmailer ) {
$phpmailer->Host = 'mailhog';
$phpmailer->Port = 1025;
$phpmailer->IsSMTP();
}
add_action( 'phpmailer_init', 'mailhog_setup' );
fileuploads = On
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 600
@shanebp
Copy link
Author

shanebp commented Apr 18, 2019

sudo docker-compose up -d

sudo docker-compose down

Put uploads.ini in ~/wordpress/
The first time you create this container and any time you wipe the volumes, you may need to comment out this line:

# - ~/wordpress/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini

Because the directory won't exist yet.
Then delete the container, move the file to the directory and restart the container.

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