File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # 阶段一:构建静态站点(全架构支持: amd64 / arm64 / armv7)
1+ # 阶段一:构建静态站点(amd64 / arm64 / armv7 全支持 )
22FROM ubuntu:22.04 AS builder
33
44RUN apt-get update && apt-get install -y --no-install-recommends \
5- git curl ca-certificates && \
5+ git curl ca-certificates golang-go && \
66 rm -rf /var/lib/apt/lists/*
77
8- # 自动识别架构并下载对应 Hugo
8+ # 自动识别架构下载 Hugo
99ARG TARGETARCH
1010RUN case ${TARGETARCH} in \
1111 "amd64" ) HUGO_ARCH="64bit" ;; \
@@ -20,10 +20,11 @@ RUN case ${TARGETARCH} in \
2020
2121RUN hugo version
2222
23- # 下载并构建站点
23+ # 下载站点源码
2424RUN git clone --depth 1 https://github.com/hugo-fixit/hugo-fixit-starter.git /build
2525WORKDIR /build
2626
27+ # 构建(现在 go 已安装,不会报错)
2728RUN hugo --minify --baseURL "/" --destination /public
2829
2930# 修复路径
@@ -32,18 +33,17 @@ RUN find /public -type f -name "*.html" -exec sed -i 's|/hugo-fixit-starter/|/|g
3233# 复制静态资源
3334RUN cp -r /build/static/* /public/ 2>/dev/null || true
3435
35- # 创建缺失图标
36+ # 创建缺失图标(不依赖 imagemagick,避免报错)
3637RUN for icon in apple-touch-icon.png favicon-32x32.png favicon-16x16.png; do \
3738 if [ ! -f "/public/$icon" ]; then \
38- echo "Creating placeholder: $icon" ; \
3939 touch /public/$icon; \
4040 fi; \
4141done
4242
43- # 验证构建结果
43+ # 验证
4444RUN test -f /public/index.html
4545
46- # 阶段二:运行(支持所有架构 )
46+ # 阶段二:运行(跨架构 )
4747FROM nginx:1.29-alpine-slim
4848
4949RUN apk upgrade --no-cache && \
You can’t perform that action at this time.
0 commit comments