From a873662d5ede73b26ccc848fb57133e9965eacb2 Mon Sep 17 00:00:00 2001 From: wuchao <1272174216@qq.com> Date: Thu, 27 Jun 2024 15:08:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9F=A5=E8=AF=A2=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5ea719..32477df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,10 @@ # 创建最终镜像,用于运行编译后的Go程序 FROM alpine +#设置时区 +ENV TimeZone=Asia/Shanghai +# 使用软连接,并且将时区配置覆盖/etc/timezone +RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone WORKDIR /app # 将编译好的二进制文件从构建阶段复制到运行阶段 @@ -32,8 +36,6 @@ WORKDIR /app COPY /server . #COPY --from=builder /app/server . COPY .env . -#设置时区 -ENV TimeZone=Asia/Shanghai #RUN chmod +x /app/server # 设置环境变量的默认值 ENV SERVER=api