Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改Dockerfile,使得构建出的docker镜像仅为17.4M #46

Merged
merged 2 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
FROM alpine:latest as prod

RUN apk --no-cache add ca-certificates

WORKDIR /root/

COPY --from=0 /root/build/server .

CMD ["./server"]
2 changes: 0 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

import (
"fmt"
"os"
"strings"

Expand Down Expand Up @@ -70,7 +69,6 @@ func GetWechatKeyword() *string {

func GetTelegram() *string {
tg := getEnv("telegram")
fmt.Println(tg)
if tg != nil {
return tg
}
Expand Down