# Build Stage | |
# 使用 golang:alpine 作为构建阶段的基础镜像 | |
FROM golang:alpine AS builder | |
# 添加 git,以便之后能从GitHub克隆项目 | |
RUN apk --no-cache add git | |
# 从 GitHub 克隆 go-proxy-bingai 项目到 /workspace/app 目录下 | |
RUN git clone https://github.com/Harry-zklcdc/go-proxy-bingai.git /workspace/app | |
WORKDIR /workspace/app | |
RUN go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go | |
FROM alpine | |
WORKDIR /workspace/app | |
COPY --from=builder /workspace/app/go-proxy-bingai . | |
ENV Go_Proxy_BingAI_USER-TOKEN_1="kJs8hD92ncMzlaoQWYtx5rG6bE3tz4i0" | |
EXPOSE 8080 | |
CMD ["/workspace/app/go-proxy-bingai"] |