Created
December 21, 2019 15:07
-
-
Save michielvaneerd/3d7f7a64f737ca351a731fdb9583a44d to your computer and use it in GitHub Desktop.
Wordpress docker file with node and npm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of Wordpress docker installation for Gutenberg plugin development where you need node and npm. | |
# Used for plugin development. | |
# Put this docker-compose file in the root of your plugin directory. | |
# This setup removes the src and node_modules directory from the mount to the container. | |
# This will improve the performance for Mac, because it doesn't has to sync so much files. | |
# After running this setup, you can just use npm install on your host. | |
version: '3.3' | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: somewordpress | |
MYSQL_DATABASE: wordpress | |
MYSQL_USER: wordpress | |
MYSQL_PASSWORD: wordpress | |
wordpress: | |
depends_on: | |
- db | |
image: wordpress:latest | |
ports: | |
- "8000:80" | |
restart: always | |
volumes: | |
# This only mounts the current working dir to the WP plugin dir. | |
# This means that all other WP files are copied everytime after docker-compose down. | |
- ./:/var/www/html/wp-content/plugins/my-plugin | |
# Remove dev dirs from the mount. | |
- my_plugin_src:/var/www/html/wp-content/plugins/my-plugin/src/ | |
- my_plugin_node_modules:/var/www/html/wp-content/plugins/my-plugin/node_modules/ | |
environment: | |
WORDPRESS_DB_HOST: db:3306 | |
WORDPRESS_DB_USER: wordpress | |
WORDPRESS_DB_PASSWORD: wordpress | |
WORDPRESS_DB_NAME: wordpress | |
volumes: | |
db_data: {} | |
my_plugin_src: {} | |
my_plugin_node_modules: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment