Skip to content

Instantly share code, notes, and snippets.

@MikeiLL
Created April 5, 2017 14:31
Show Gist options
  • Save MikeiLL/4ce578203ba3668252918d051fbadd22 to your computer and use it in GitHub Desktop.
Save MikeiLL/4ce578203ba3668252918d051fbadd22 to your computer and use it in GitHub Desktop.
#!/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"
EOL
docker-compose up -d
alias wp="docker-compose run --rm my-wpcli"
wp --info
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment