How to build a minimized docker image for Hexo
To start with, it is not easy for greenhands to write out an appropriate buildfile for hexo
in docker
.
As is suggested, Alpine
is a minimized Linux environment designated for docker images, which appears to be tiny in size.
Yet it is tough to upgrade node
and npm
if the pulled version of alpine
is outmoded, so take a look when choosing the right origin of the mirror.
The version of localization in China:
1 | FROM daocloud.io/library/alpine:3.6 |
Otherwise:
1 | FROM daocloud.io/library/alpine:3.6 |
1 | docker build -t crxon/alpine-hexo -f hexo-in-docker-alpine . |
Run after build:
1 | docker run --name myhexo -p 4000:4000 -v ~/blog:/root/blog -d crxon/alpine-hexo:release |
Debug:
1 | docker run --rm --name myhexo -p 4000:4000 -v ~/blog:/root/blog -it crxon/alpine-hexo:debug /bin/bash |
How to build a minimized docker image for Hexo