Last active
August 29, 2015 14:18
-
-
Save wturnerharris/43f910c3a09cdc52f1c3 to your computer and use it in GitHub Desktop.
quick docker init script
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 | |
if [ $# -eq 0 ]; then | |
printf "===> Needs s fully-qualified git repo\n" | |
exit | |
fi | |
printf "===> Installing dependencies...\n" | |
apt-get install -y wget nano git | |
printf "===> Changing to webroot and copying/downloading WordPress...\n" | |
cd /var/www/html | |
wget https://wordpress.org/latest.tar.gz | |
tar -xzf latest.tar.gz | |
mv wordpress/* . | |
rm -rf wordpress latest.tar.gz | |
chown -R www-data:www-data /var/www/html | |
cd ../ | |
printf "===> Cloning repo...\n" | |
git clone $1 clone | |
mv clone/.git html/.git | |
rm -rf clone/ | |
cd html/ | |
printf "===> Fetching all remotes...\n" | |
git fetch --all | |
git checkout $2 | |
git reset --hard HEAD | |
mv wp-config-sample.php wp-config.php | |
printf "===> Setup wp-config, either manually or download via wget.\n\n" | |
printf " /** assuming root mysql user */\n" | |
printf " define('DB_PASSWORD', getenv('MYSQL_PORT_3306_TCP_ADDR')); \n" | |
printf " define('DB_HOST', getenv('MYSQL_ENV_MYSQL_ROOT_PASSWORD')); \n" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Details
This script will...
First
first
chmod +x wp_docker.sh
Usage
./wp_docker [repo] [branch]
Ex:
./wp_docker.sh https://username:password@path_to_git_repo branch_name