From 025f2306a304894515b327c118fe0224e5e62dd6 Mon Sep 17 00:00:00 2001 From: sunrise <575563079@qq.com> Date: Fri, 10 Feb 2023 04:25:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Dockerfile,=E4=BD=BF=E5=BE=97?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=87=BA=E7=9A=84docker=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E4=BB=85=E4=B8=BA17.4M?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b4f955..a68ede2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,20 @@ -FROM golang:1.19-alpine +FROM golang:1.19-alpine as builder -ENV api_key="" +RUN apk --no-cache add git && export GOPRIVATE=github.com/houko/wechatgpt && \ + export GOPROXY=https://goproxy.cn,direct -RUN export GOPRIVATE=github.com/houko/wechatgpt +COPY . /root/build -WORKDIR /app - -COPY . /app +WORKDIR /root/build RUN go mod download && go build -o server main.go -CMD ./server \ No newline at end of file +FROM alpine:latest as prod + +RUN apk --no-cache add ca-certificates + +WORKDIR /root/ + +COPY --from=0 /root/build/server . + +CMD ["./server"] \ No newline at end of file