Created
March 11, 2016 08:30
-
-
Save rakuishi/a7739c45a1624b94c46b 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/sh | |
PROJECT=sample | |
DATABASE=sample | |
case $1 in | |
"start") | |
docker rm -f ${PROJECT} | |
docker build -t ${PROJECT} . | |
docker rmi $(docker images | awk '/^<none>/ { print $3 }') | |
docker run -d -p 80:80 \ | |
-v $(pwd):/data-share \ | |
--name=${PROJECT} ${PROJECT} | |
open "http://$(docker-machine ip default)" | |
;; | |
"bash") | |
docker exec -it ${PROJECT} bash | |
;; | |
"dump") | |
docker exec ${PROJECT} sh -c "mysqldump -u root ${DATABASE} > /data-share/dump.sql" | |
;; | |
*) | |
echo "Usage: $0 <start|bash|dump>" | |
exit 2 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment