Coder Social home page Coder Social logo

docker-hexo's Introduction

为什么将hexo做成Docker镜像

避免每次写文章和发布,还要在安装了Hexo,Nodejs.Docker打包好了一切,只需要运行Docker.

前提条件

  1. install docker

  2. 只需要 下面4个挂载的内容到容器即可.

创建和上传镜像

    docker build -t femn/hexo .
    docker login
    docker push femn/hexo

运行镜像

  1. pull images
    docker pull femn/hexo
  1. run images
docker run  -it --rm -p 4000:4000 --name femn-hexo  \
    -v /home/femn/.ssh:/home/femn/.ssh \
    -v /home/femn/blog/source:/home/femn/blog/source \
    -v /home/femn/blog/_config.yml:/home/femn/blog/_config.yml \
    -v /home/femn/blog/README.md:/home/femn/blog/README.md \
    -v /home/femn/blog/deploy/leipengkai.github.io:/home/femn/blog/deploy/leipengkai.github.io \
    femn/hexo sh -l

效果

如果仅仅是想看hexo博客的效果的话,此镜像还是可以满足的(themes:icarus) http://localhost:4000

缺点

由于本人能力有限,此镜像只是针对本人使用,但个人觉得Dockerfile,可以供新手参考.

本人使用

# 在容器中使用
hexo g # 生成静态文件
hexo s # 启动服务
sh ./update_blog.sh "xx"  # 将博客上传到github上
# 再手动将~/blog(将不会有github内容) 上传到gitlab上

docker-hexo's People

Contributors

leipengkai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.