Skip to content

Commit 3e1ce4f

Browse files
authored
Update Dockerfile
1 parent c7d96ec commit 3e1ce4f

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

Dockerfile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,41 @@
1-
# 阶段一:构建默认站点(使用官方示例站点 + FixIt 主题)
2-
FROM peaceiris/hugo-extended:0.156.0 AS builder
1+
# 阶段一:构建默认站点
2+
FROM hugomods/hugo:0.156.0-exts AS builder
33

44
# 安装 git(主题需要)
55
RUN apk add --no-cache git
66

77
WORKDIR /build
88

9-
# 克隆 FixIt 主题(使用稳定版本标签,可改为具体 commit
9+
# 克隆 FixIt 主题(使用稳定版本标签)
1010
RUN git clone --depth 1 --branch v0.3.6 https://github.com/hugo-fixit/FixIt.git themes/FixIt
1111

12-
# 复制官方示例站点(不含主题,因为我们要用上面克隆的)
12+
# 复制官方示例站点
1313
RUN git clone --depth 1 https://github.com/hugo-fixit/FixIt.git tmp_fixit && \
1414
cp -r tmp_fixit/exampleSite/* . && \
1515
rm -rf tmp_fixit
1616

17-
# 修正示例站点的主题配置(确保指向 themes/FixIt)
17+
# 修正主题配置
1818
RUN sed -i 's|theme = .*|theme = "FixIt"|' config.toml
1919

20-
# 构建默认静态文件(作为后备)
20+
# 构建默认静态文件
2121
RUN hugo --minify --destination /default-public
2222

23-
# 阶段二:运行时镜像(包含 hugo 二进制和源码,支持动态生成)
23+
# 阶段二:运行时镜像
2424
FROM nginx:stable-alpine
2525

26-
# 安装 bash 和 C++ 运行时(hugo 依赖)
2726
RUN apk add --no-cache bash libstdc++
2827

2928
# 复制 hugo 二进制
3029
COPY --from=builder /usr/bin/hugo /usr/local/bin/hugo
3130

32-
# 复制默认站点的完整源码(用于运行时重新生成)
31+
# 复制默认站点的完整源码
3332
COPY --from=builder /build /app/default-site
34-
# 复制默认生成的静态文件(作为后备)
3533
COPY --from=builder /default-public /usr/share/nginx/html
3634

37-
# 创建用户可挂载的目录
3835
RUN mkdir -p /data/{content,static,layouts,assets,data} /config
3936

40-
# 复制入口脚本
4137
COPY docker-entrypoint.sh /usr/local/bin/
4238
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
4339

4440
EXPOSE 80
45-
4641
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

0 commit comments

Comments
 (0)