Created
March 1, 2017 03:27
-
-
Save MikeiLL/522e21e9d8a4860323f663434f983b0e to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Read more: https://medium.com/@tatemz/using-wp-cli-with-docker-21b0ab9fab79#.bzqhqfa6a | |
# Also see https://github.com/chriszarate/docker-wordpress | |
if [ $# -eq 0 ] ; then | |
echo usage: directory_name | |
else | |
WPDIR="$1" | |
mkdir "$WPDIR" && cd "$WPDIR" | |
cat >> docker-compose.yml <<EOL | |
my-wpdb: | |
image: mariadb | |
ports: | |
- "8081:3306" | |
environment: | |
MYSQL_ROOT_PASSWORD: dockerpass | |
my-wp: | |
image: wordpress | |
volumes: | |
- ./:/var/www/html | |
ports: | |
- "8080:80" | |
links: | |
- my-wpdb:mysql | |
environment: | |
WORDPRESS_DB_PASSWORD: dockerpass | |
my-wpcli: | |
image: tatemz/wp-cli | |
volumes_from: | |
- my-wp | |
links: | |
- my-wpdb:mysql | |
entrypoint: wp | |
command: "--info" | |
my-phpunit: | |
image: phpunit/phpunit | |
volumes_from: | |
- my-wp | |
links: | |
- my-wpdb | |
EOL | |
docker-compose up -d | |
alias wpcli="docker-compose run --rm my-wpcli" | |
wpcli --info | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment