1. Hexo镜像模版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# ======= 缓存 =======
FROM node as builder

WORKDIR /app
COPY package.json .
RUN npm install

# ======= 构建 =======
FROM node

ENV HEXO_SsERVER_PORT=4000

# 安装依赖
RUN npm cache clear --force && \
npm install -g hexo-cli

WORKDIR /app
COPY --from=builder /app/ /app/
COPY . .

# 暴露端
EXPOSE ${HEXO_SERVER_PORT}

# 运行指令
CMD hexo server -p ${HEXO_SERVER_PORT}