Skip to content

Instantly share code, notes, and snippets.

@davidmfoley
Last active May 4, 2018 18:46
Show Gist options
  • Save davidmfoley/74586660d7cb70165b8196b54973543d to your computer and use it in GitHub Desktop.
Save davidmfoley/74586660d7cb70165b8196b54973543d to your computer and use it in GitHub Desktop.
Sample wordpress docker compose setup for local development
version: '3'
services:
db:
image: mysql:5.7
volumes:
- site_db_data:/var/lib/mysql
restart: always
ports:
# bind to host port so we can run mysql tools on host
# you can remove this if you don't wish to do that
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8080:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
volumes:
# mount theme readonly, since we will edit on the host
- ./wp-content/themes/your-theme:/var/www/html/wp-content/themes/your-theme:ro
# mount plugins
- ./wp-content/plugins:/var/www/html/wp-content/plugins
# uploads: ymmv. Won't necessarily need this if working
# on a greenfield wp site.
- ./wp-content/uploads:/var/www/html/wp-content/uploads
# this is a hack to *not* mount the ssl plugin for local dev
# since it renders the whole site inaccessible unless https
- ignore_ssl:/var/www/html/wp-content/plugins/really-simple-ssl
# local config file
- ./wp-config-local.php:/var/www/wp-config-local.php
volumes:
site_db_data:
ignore_ssl:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment