# Build Stage # 使用 golang:alpine 作为构建阶段的基础镜像 FROM golang:alpine AS builder # 添加 git,并且清除缓存🧹 RUN apk --no-cache add git && \ git clone https://github.com/Harry-zklcdc/go-proxy-bingai.git /workspace/app && \ apk del git # 设置工作目录 WORKDIR /workspace/app # 编译 go 项目 RUN go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go # Runtime Stage # 使用轻量级的 alpine 镜像🪞 FROM alpine # 设置工作目录💼 WORKDIR /workspace/app # 从构建阶段复制编译后的二进制文件👔 COPY --from=builder /workspace/app/go-proxy-bingai . # (可选)设置环境变量✍️ ENV Go_Proxy_BingAI_USER_TOKEN_1="skfhsjkdfhshglisjgohgrehrt4h65rh4thrtfj6tyk7ty6tfj" # 端口 EXPOSE 8080 # 容器运行✅ CMD ["/workspace/app/go-proxy-bingai"]