Skip to content

Instantly share code, notes, and snippets.

@sidneydemoraes
Created April 15, 2019 15:06
Show Gist options
  • Save sidneydemoraes/aa25187ab9c32bf93cb71686c057a9a1 to your computer and use it in GitHub Desktop.
Save sidneydemoraes/aa25187ab9c32bf93cb71686c057a9a1 to your computer and use it in GitHub Desktop.
WP docker-compose example
version: '3.5'
services:
wordpress:
image: wordpress-with-theme
build: <git-repo-here>
restart: unless-stopped
depends_on:
- database
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 15s
timeout: 15s
retries: 3
environment:
- WORDPRESS_DB_NAME=testing
- WORDPRESS_DB_USER=testing
- WORDPRESS_DB_PASSWORD=testing
- WORDPRESS_DB_HOST=database
volumes:
- "./conf/back/custom.ini:/usr/local/etc/php/conf.d/custom.ini:z" # DO NOT REMOVE! Necessary PHP settings
- "backend-theme:/var/www/html/wp-content/themes/theme" # DO NOT REMOVE! Needed for docker-based theme
- "backend-content:/var/www/html/wp-content" # DO NOT REMOVE! Data persistence for plugins, uploads and other folders
- "backend-root:/var/www/html" # DO NOT REMOVE! Needed for wp-cli
database:
image: mariadb:10
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
interval: 15s
timeout: 5s
retries: 3
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_DATABASE=testing
- MYSQL_USER=testing
- MYSQL_PASSWORD=testing
volumes:
- "./import:/docker-entrypoint-initdb.d:Z"
- "database:/var/lib/mysql"
cli:
image: wordpress:cli
depends_on:
- wordpress
user: "33:33"
working_dir: "/var/www/html"
volumes:
- "./conf/back/custom.ini:/usr/local/etc/php/conf.d/custom.ini:z" # DO NOT REMOVE! Necessary PHP settings
- "backend-theme:/var/www/html/wp-content/themes/theme" # DO NOT REMOVE! Needed for docker-based theme
- "backend-content:/var/www/html/wp-content" # DO NOT REMOVE! Data persistence for plugins, uploads and other folders
- "backend-root:/var/www/html" # DO NOT REMOVE! Needed for wp-cli
volumes:
database:
backend-content:
backend-root:
backend-theme:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment