Skip to content

Commit fd4164f

Browse files
authored
Update Dockerfile
1 parent 4fcba7d commit fd4164f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# 阶段一:构建静态站点(全架构支持:amd64 / arm64 / armv7)
1+
# 阶段一:构建静态站点(amd64 / arm64 / armv7 全支持
22
FROM ubuntu:22.04 AS builder
33

44
RUN 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
99
ARG TARGETARCH
1010
RUN case ${TARGETARCH} in \
1111
"amd64") HUGO_ARCH="64bit" ;; \
@@ -20,10 +20,11 @@ RUN case ${TARGETARCH} in \
2020

2121
RUN hugo version
2222

23-
# 下载并构建站点
23+
# 下载站点源码
2424
RUN git clone --depth 1 https://github.com/hugo-fixit/hugo-fixit-starter.git /build
2525
WORKDIR /build
2626

27+
# 构建(现在 go 已安装,不会报错)
2728
RUN 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
# 复制静态资源
3334
RUN cp -r /build/static/* /public/ 2>/dev/null || true
3435

35-
# 创建缺失图标
36+
# 创建缺失图标(不依赖 imagemagick,避免报错)
3637
RUN 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; \
4141
done
4242

43-
# 验证构建结果
43+
# 验证
4444
RUN test -f /public/index.html
4545

46-
# 阶段二:运行(支持所有架构
46+
# 阶段二:运行(跨架构
4747
FROM nginx:1.29-alpine-slim
4848

4949
RUN apk upgrade --no-cache && \

0 commit comments

Comments
 (0)