Created
March 4, 2021 16:50
-
-
Save cdevroe/6d7d4bd01827627215787e9712ab903b to your computer and use it in GitHub Desktop.
Docker Compose for WordPress with theme mapped (example for my blog)
This file contains 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
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 | |
volumes: | |
- /Users/cdevroe/Sites/wordpress_themes/cypress/dist:/var/www/html/wp-content/themes/cypress | |
ports: | |
- "8000:80" | |
restart: always | |
environment: | |
WORDPRESS_DB_HOST: db:3306 | |
WORDPRESS_DB_USER: wordpress | |
WORDPRESS_DB_PASSWORD: wordpress | |
WORDPRESS_DB_NAME: wordpress | |
volumes: | |
db_data: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those that want to map a local directory to one within the Docker container, look at the bit around Line 20.
This maps my local directory to one within WordPress in the container. Every time I save my theme files they are immediately live within WordPress.