fix: Docker 时区配置(保留tzdata+ENV TZ)

- 原 apk del tzdata 导致容器 UTC, 定时任务无法在 00:00 触发

- 保留 tzdata 并设置 ENV TZ=Asia/Shanghai (Go time 库依赖)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-08-24 00:19:45 +08:00
parent 36985771d5
commit 5223a30c69

View File

@@ -12,10 +12,11 @@ RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o electric-mon
# 阶段2: 最小运行镜像 # 阶段2: 最小运行镜像
FROM alpine:3.20 FROM alpine:3.20
# 时区: 定时任务需按北京时间 00:00 触发 # 时区: 定时任务需按北京时间 00:00 触发
# 保留 tzdata 并设置 TZ 环境变量 (Go time 库依赖它apk del 会导致 UTC)
ENV TZ=Asia/Shanghai
RUN apk add --no-cache tzdata \ RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \ && echo "Asia/Shanghai" > /etc/timezone
&& apk del tzdata
# 数据目录(历史记录 + 缓存挂载点) # 数据目录(历史记录 + 缓存挂载点)
RUN mkdir -p /app/data RUN mkdir -p /app/data
WORKDIR /app WORKDIR /app