From ad134121c9a0c5b130d25b89c3a1662587348f87 Mon Sep 17 00:00:00 2001 From: wuchao <1272174216@qq.com> Date: Thu, 27 Jun 2024 15:25:27 +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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32477df..c5f9f5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,11 +22,11 @@ #RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o server main.go # 创建最终镜像,用于运行编译后的Go程序 -FROM alpine +FROM golang:1.21.0 as host #设置时区 -ENV TimeZone=Asia/Shanghai -# 使用软连接,并且将时区配置覆盖/etc/timezone -RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone +# 复制宿主机的时区文件到容器内 +COPY --from=host /etc/timezone /etc/timezone +COPY --from=host /etc/localtime /etc/localtime WORKDIR /app # 将编译好的二进制文件从构建阶段复制到运行阶段