-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
容器配置时区为东八时区 #4
Comments
经测试, 将基镜像(基于debian)的 FROM golang:1.20 as builder
ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct
WORKDIR /usr/src/app
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY a2w.go .
RUN CGO_ENABLED=0 go build -o /usr/local/bin/a2w a2w.go
FROM scratch
ENV GIN_MODE=release
WORKDIR /app
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo #新增行, 也可使用args定义变量
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /usr/local/bin/a2w .
COPY templates templates
ENV TZ=Asia/Shanghai #新增行, 也可使用ARG定义变量
EXPOSE 5001
ENTRYPOINT ["./a2w"]
|
我想了解一下为何要添加时区?目前使用中没有遇到过时间错误的问题。 而且 Prometheus 也是 UTC 时区,并且不能修改,官方文档:Can I change the timezone? Why is everything in UTC? |
我们在输出企业微信消息的时候, 初始信息是不带时区的时间, 显示有歧义. Line 196 in 5ec3f48
|
我测试了一下确实是有这个问题,a2w 容器内的时区不是上海时区,这个项目一般是在中国使用的,所以改为东八时区还是有意义的。 你愿意提交一个 PR 么?感谢你指出这个问题。 |
感谢你指出这个问题,我已经合并了相关内容。 |
现在输出的时间是 UTC时间, 我们应该设置成+8时区
我正在尝试参考:
https://cloud.tencent.com/developer/article/1666529
编辑
dockerfile
以及a2w.go
有进展同步.
The text was updated successfully, but these errors were encountered: