0%

Serve Hexo blog using Docker

You can simply add a Dockerfile which looks like:

1
2
3
4
5
6
7
8
9
10
11
FROM node:alpine AS builder

RUN npm config set unsafe-perm true && npm install -g hexo-cli

COPY . /app
WORKDIR /app
RUN npm install && hexo generate

FROM httpd:alpine

COPY --from=builder /app/public /usr/local/apache2/htdocs/

Then call docker build -t image:tag . to build your own blog. To run the blog locally, you can
simply run command docker run -p {host_port}:80 image:tag.