jekyll运行依赖ruby,每次重装都会遇到版本问题,挺麻烦,干脆做成镜像
docker上有jekyll的官方镜像,如果是直接运行,没什么问题。
如果你挂载volume就会有权限问题
jekyll 3.8.5 | Error: Permission denied @ dir_s_mkdir - /srv/jekyll/_site
从官方镜像jekyll中拿到入口文件,做一点修改
#!/bin/bash
[ "$DEBUG" = "true" ] && set -x
set -e
# --
: ${JEKYLL_UID:=$(id -u jekyll)}
: ${JEKYLL_GID:=$(id -g jekyll)}
# --
export JEKYLL_UID
export JEKYLL_GID
# --
# Users can customize our UID's to fit their own so that
# we don't have to chown constantly. Well it's not like
# we do so much of it (anymore) it's slow, but we do
# change permissions which can result in some bad
# behavior on OS X.
# --
if [ "1" != "0" ] ; then # 修改了此处,改目录权限
usermod -u $JEKYLL_UID jekyll
groupmod -g $JEKYLL_GID jekyll
chown_args=""
[ "$FULL_CHOWN" ] && chown_args="-R"
for d in "$JEKYLL_DATA_DIR" "$JEKYLL_VAR_DIR"; do
chown $chown_args jekyll:jekyll "$d"
done
fi
# --
exec "$@"
FROM jekyll/builder:3.8
COPY --chown=jekyll:jekyll entrypoint /usr/jekyll/bin/entrypoint
RUN gem install jekyll-admin redcarpet
docker build . -t wyq/blog:0.1
version: '2'
services:
blog:
image: wyq/blog:0.1
volumes:
- ./blog:/srv/jekyll
ports:
- "4000:4000"
command: jekyll serve -P 4000 -H 0.0.0.0 -w
docker-compose -f docker-compose.yml up
来源
http://www.yongqingking.top/docker/2019/04/08/docker-jekyll.html
此生必看的科学实验-水知道答案
《了凡四训》详解之改过之法
印光大师十念法(胡小林主讲第1集)
精神病为什么治不好
百病之源