Sign inSign up

microwww/jekyll

By microwww

•Updated about 7 years ago

Image
0

211

microwww/jekyll repository overview

⁠Docker file

FROM jekyll/jekyll

#RUN git https://gitee.com/changshu/blog.git
RUN gem install jekyll-seo-tag

VOLUME /git/
VOLUME /www/

ARG TEMPLATE=/git/template
ARG POSTS=/git/posts

RUN echo "#!/bin/bash" >> /docker_entrypoint.sh \
    && echo "set -e" >> /docker_entrypoint.sh \
    && echo "cd /git/ && git pull" >> /docker_entrypoint.sh \
    && echo "chown -R jekyll /www/" >> /docker_entrypoint.sh \
    && echo "rm -rf ${TEMPLATE}/_posts" >> /docker_entrypoint.sh \
    && echo "cp -r ${POSTS} ${TEMPLATE}/_posts" >> /docker_entrypoint.sh \
    && echo "cd ${TEMPLATE}" >> /docker_entrypoint.sh \
    && echo "jekyll build -d /www/ --incremental" >> /docker_entrypoint.sh \
    && echo "git checkout ." >> /docker_entrypoint.sh

RUN chmod +x /docker_entrypoint.sh

CMD ["/docker_entrypoint.sh"]

⁠BUILDING

Build from /git/ to /www/ . Posts at /git/posts and template at /git/template as default !

You can set args: --build-arg TEMPLATE=/git/template --build-arg POSTS=/git/posts, like this:

sudo docker build -t microwww/jekyll:latest --build-arg TEMPLATE=/git/template --build-arg POSTS=/git/posts .

⁠RUN Demo

By git pull the latest post, and jekyll build -d /www .

sudo docker run -it --rm -v /data/blog/www/:/www/ -v /data/blog/blog/:/git/ microwww/jekyll

Good luck !

Tag summary

Content type

Image

Digest

Size

235 MB

Last updated

about 7 years ago

docker pull microwww/jekyll