Skip to content

Instantly share code, notes, and snippets.

@joshmoto
Created March 14, 2021 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshmoto/ec7223c40bf7f6378094cd06b6006221 to your computer and use it in GitHub Desktop.
Save joshmoto/ec7223c40bf7f6378094cd06b6006221 to your computer and use it in GitHub Desktop.
docker-compose.yml
version: '3.7'
services:
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- ./:/var/www/html/wp-content/plugins/building-blocks
- ./wp-content:/var/www/html/wp-content
ports:
- "80:80"
restart: always
environment:
# docker wp config settings
# these can be the same for every local docker project
# never pass these to the staging or production wp-configs
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
WORDPRESS_AUTH_KEY: 5f6ede1b94d25a2294e29eeba929a8c80a5ac0fb
WORDPRESS_SECURE_KEY: 5f6ede1b94d25a2294e29eeba929a8c80a5ac0fb
WORDPRESS_LOGGED_IN_KEY: 5f6ede1b94d25a2294e29eeba929a8c80a5ac0fb
WORDPRESS_NONCE_KEY: 5f6ede1b94d25a2294e29eeba929a8c80a5ac0fb
WORDPRESS_SECURE_AUTH_SALT: 5f6ede1b94d25a2294e29eeba929a8c80a5ac0fb
WORDPRESS_LOGGED_IN_SALT: 5f6ede1b94d25a2294e29eeba929a8c80a5ac0fb
WORDPRESS_NONCE_SALT: 5f6ede1b94d25a2294e29eeba929a8c80a5ac0fb
# extra wp configs
WORDPRESS_CONFIG_EXTRA: |
/* local parameters */
define('WP_CACHE', false);
define('ENVIRONMENT', 'local');
define('WP_DEBUG', true);
/* if wp home is not defined */
if(!defined('WP_HOME')) {
/* force our home url override for permalinks and wp get functions */
define('WP_HOME', 'http://localhost');
define('WP_SITEURL', WP_HOME);
}
db:
image: mysql:5.7
volumes:
# our persistent local database re routing
- ./db:/var/lib/mysql:delegated
ports:
- "3306:3306"
restart: always
environment:
# these can be the same for every local docker project
# never pass these to the staging or production wp-configs database settings
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment