Merge pull request #46 from fireinrain/main
修改Dockerfile,使得构建出的docker镜像仅为17.4M
This commit is contained in:
commit
9cdc7cfe75
21
Dockerfile
21
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
|
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"]
|
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user