Skip to content

Commit ae83136

Browse files
authored
docs: add custom time zone example (#651)
使用 Docker 打出的镜像,默认会使用0区时区,会影响到日志、数据库等时间的显示,考虑到全球化,可在镜像运行时, 设置环境变量 `TZ` 即可解决该问题,TZ 列表可参考:[https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)。
1 parent 6b4f9af commit ae83136

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/deploy-in-docker.md

+9
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ CNPMCORE_LOG_DIR=/var/log/cnpmcore
7272
CNPMCORE_CONFIG_REGISTRY=https://your-registry.com
7373
```
7474

75+
### 时区
76+
77+
时区可以通过环境变量`TZ`来设置,可以使用地区标识符如`Asia/Shanghai`,也可以使用时区标识符如`Etc/GMT-8`(东八区)、`Etc/GMT+8`(西八区),具体TZ列表见[List](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)
78+
79+
```bash
80+
TZ=Asia/Shanghai
81+
```
82+
7583
### 使用 `config.prod.js` 覆盖
7684

7785
直接覆盖 `/usr/src/app/config/config.prod.js` 文件也可以实现生产配置自定义。
@@ -145,6 +153,7 @@ docker run -p 7001:7001 -it --rm \
145153
-e CNPMCORE_REDIS_PORT=6379 \
146154
-e CNPMCORE_REDIS_PASSWORD=your-redis-password \
147155
-e CNPMCORE_REDIS_DB=1 \
156+
-e TZ=Asia/Shanghai \
148157
--name cnpmcore-prod cnpmcore
149158
```
150159

0 commit comments

Comments
 (0)