Created
May 22, 2021 13:16
-
-
Save dingo-d/94bb4440857e1b864b73ec93ef1e745a to your computer and use it in GitHub Desktop.
Example of docker compose file with WP and WP-CLI (allowed root). Note to self: when specifying command parameter in the compose file you'll need to add the default entrypoint and commands that are running on the default image you're pulling info from.
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
version: "3.9" | |
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: | |
- ./:/var/www/html | |
environment: | |
WORDPRESS_DB_HOST: db:3306 | |
WORDPRESS_DB_USER: wordpress | |
WORDPRESS_DB_PASSWORD: wordpress | |
WORDPRESS_DB_NAME: wordpress | |
WP_CLI_ALLOW_ROOT: "true" | |
command: > | |
bash -c "curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; | |
chmod +x wp-cli.phar; | |
mv wp-cli.phar /usr/local/bin/wp; | |
sh /usr/local/bin/docker-entrypoint.sh; | |
apache2-foreground;" | |
volumes: | |
db_data: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment