Dockerfiles/hexo/bootstrap.sh

22 lines
393 B
Bash
Raw Permalink Normal View History

2018-01-15 07:12:12 +00:00
#!/bin/sh
2016-11-11 10:33:18 +00:00
2018-01-15 07:12:12 +00:00
# configure git
2016-12-01 03:51:10 +00:00
git config --global user.email $GIT_EMAIL
git config --global user.name $GIT_NAME
2018-01-15 07:12:12 +00:00
# init hexo if dir is empty
2018-01-15 07:26:41 +00:00
if ! [ "$(ls -A ./ )" ]; then
hexo init && npm install
2018-01-15 07:12:12 +00:00
fi
2018-08-22 12:44:47 +00:00
# install modules if not
[ -d "node_modules" ] || npm install --from-lockfile
2018-01-15 07:12:12 +00:00
# run hexo as production / developemnt mode
if [[ $1 == "production" ]]; then
2018-08-22 12:44:47 +00:00
hexo server -s
2018-01-15 08:36:37 +00:00
else
2018-08-22 12:44:47 +00:00
hexo server
2016-11-11 10:33:18 +00:00
fi