Merge pull request #46 from fireinrain/main

修改Dockerfile,使得构建出的docker镜像仅为17.4M
This commit is contained in:
涼風羽月 2023-02-12 18:24:57 +09:00 committed by GitHub
commit 9cdc7cfe75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -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 WORKDIR /root/build
COPY . /app
RUN go mod download && go build -o server main.go RUN go mod download && go build -o server main.go
CMD ./server FROM alpine:latest as prod
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /root/build/server .
CMD ["./server"]

View File

@ -1,7 +1,6 @@
package config package config
import ( import (
"fmt"
"os" "os"
"strings" "strings"
@ -70,7 +69,6 @@ func GetWechatKeyword() *string {
func GetTelegram() *string { func GetTelegram() *string {
tg := getEnv("telegram") tg := getEnv("telegram")
fmt.Println(tg)
if tg != nil { if tg != nil {
return tg return tg
} }