Skip to content

Commit

Permalink
Docker 镜像添加时区 (#5)
Browse files Browse the repository at this point in the history
* 更改容器的默认时区为 Asia/Shanghai

* 添加对时区的说明
  • Loading branch information
rea1shane authored Apr 25, 2024
1 parent 5ec3f48 commit 19b8d9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ RUN CGO_ENABLED=0 go build -o /usr/local/bin/a2w a2w.go
FROM scratch

ENV GIN_MODE=release
ENV TZ=Asia/Shanghai

WORKDIR /app

COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /usr/local/bin/a2w .
COPY templates templates
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@
- url: "http://{a2w_address}/send?key={key}"
```
## 时区
程序使用本地时区格式化时间。
Docker 镜像的默认时区为 `Asia/Shanghai`。如果想要修改 Docker 镜像的时区,可以在 `docker run` 时使用参数 `-e TZ={TIME_ZONE}` 进行指定,如:

```shell
docker run --name a2w -d -p 5001:5001 -e TZ=Asia/Tokyo rea1shane/a2w
```

## 消息模板

消息模板决定了企业微信机器人发出的消息格式,修改 `Makefile` 中的 `TEMPLATE` 变量的值来选择模板。
Expand Down

0 comments on commit 19b8d9f

Please sign in to comment.