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

This commit is contained in:
2025-08-02 10:42:43 +08:00
parent a96aa6e073
commit e936fbc140
8 changed files with 32 additions and 21 deletions

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 . .