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