Created
March 27, 2019 23:58
-
-
Save trydofor/036106b44abf8aae620e9c648110ab2b to your computer and use it in GitHub Desktop.
通过docker运行jekyll,以免搞乱系统 #docker #shell #blog
This file contains 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 | |
# https://hub.docker.com/r/bretfisher/jekyll-serve | |
path = $(pwd) | |
name = $(basename $path) | |
echo visit http://0.0.0.0:4000 | |
docker ps - a | grep $name | |
case "$1" in | |
init) | |
echo $name creating... | |
docker run \ | |
--name $name \ | |
-it \ | |
-p 4000: 4000 \ | |
-v $path: /site \ | |
bretfisher / jekyll - serve \ | |
bundle exec \ | |
jekyll serve - incremental--watch--force_polling - H 0.0.0.0 - P 4000 | |
;; | |
start) | |
docker start $name | |
;; | |
stop) | |
docker stop $name | |
;; | |
*) echo "init|stop|start" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment