From 19b712a20f6625d1a3d270c378d690b73f86b97d Mon Sep 17 00:00:00 2001 From: wuchao <1272174216@qq.com> Date: Thu, 27 Jun 2024 11:55:34 +0800 Subject: [PATCH] =?UTF-8?q?dockerfile=20=E6=96=87=E4=BB=B6=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 | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1290240..f47a0ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,26 @@ # 使用官方Go镜像作为构建环境 -FROM golang:1.21.0 AS builder - -# 设置环境变量的默认值 -ENV SERVER=api - -# 设置工作目录 -WORKDIR /app - -# 设置环境变量 -RUN go env -w GOPROXY=https://goproxy.cn,direct -ENV GOPROXY=https://goproxy.cn,direct - -# 复制项目源码 -COPY . . -# 安装snow-core -RUN go get github.com/qit-team/snow-core/kernel/server@v0.1.28 -# 安装go模块依赖 -RUN go mod tidy - -# 编译Go应用程序,生成静态链接的二进制文件 -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o server main.go +#FROM golang:1.21.0 AS builder +# +## 设置环境变量的默认值 +#ENV SERVER=api +# +## 设置工作目录 +#WORKDIR /app +# +## 设置环境变量 +#RUN go env -w GOPROXY=https://goproxy.cn,direct +#ENV GOPROXY=https://goproxy.cn,direct +# +## 复制项目源码 +#COPY . . +## 安装snow-core +#RUN go get github.com/qit-team/snow-core/kernel/server@v0.1.28 +## 安装go模块依赖 +#RUN go mod tidy +# +## 编译Go应用程序,生成静态链接的二进制文件 +#RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o server main.go # 创建最终镜像,用于运行编译后的Go程序 FROM alpine