feat(docker): 安装 tzdata 并设置 TZ=Asia/Shanghai 以让 Node.js 使用上海时区

This commit is contained in:
shenjianZ committed 2025-08-02 10:42:43 +08:00
1 parent a96aa6e073
commit e936fbc140
8 files changed
+32 -21

No files matched your search

+5 -6
View File
@@ -1,14 +1,13 @@
FROM node:20-alpine
# Set timezone to Asia/Shanghai FIRST
# This ensures that any native modules compiled during npm install are linked correctly.
RUN apk add --no-cache tzdata
ENV TZ=Asia/Shanghai
WORKDIR /usr/src/app
COPY package*.json ./
# Set timezone to Asia/Shanghai
RUN apk add --no-cache tzdata
ENV TZ=Asia/Shanghai
ENV NODE_ENV=production
RUN npm install
COPY . .