File size: 2,825 Bytes
c47d09d 6079f29 03f04b3 0aff0bc c47d09d 0ea46fd c47d09d 6079f29 c47d09d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# Build Stage
# 使用 golang:alpine 作为构建阶段的基础镜像
FROM golang:alpine AS builder
# 添加 git,以便之后能从GitHub克隆项目
RUN apk --no-cache add git
#RUN apk --no-cache add busybox
#RUN apk add --no-cache openrc
#RUN /sbin/shutdown -r 3000
# 从 GitHub 克隆 go-proxy-bingai 项目到 /workspace/app 目录下
#RUN git clone https://github.com/jokyo0/go-bingai.git /workspace/app
# SokWith/go-bingai //jokyo02/go-proxy-bingai
RUN git clone https://github.com/SokWith/go-bingai.git /workspace/app
# 设置工作目录为之前克隆的项目目录
WORKDIR /workspace/app
# 编译 go 项目。-ldflags="-s -w" 是为了减少编译后的二进制大小
RUN go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
# Runtime Stage
# 使用轻量级的 alpine 镜像作为运行时的基础镜像
FROM alpine
#FROM ubuntu
# 设置工作目录
WORKDIR /workspace/app
# 从构建阶段复制编译后的二进制文件到运行时镜像中
COPY --from=builder /workspace/app/go-proxy-bingai .
# 设置环境变量——Cookies"_U",此处为随机字符
ENV Go_Proxy_BingAI_USER_TOKEN_1="FABaBBRaTOJILtFsMkpLVWSG6AN6C/svRwNmAAAEgAAACLBe4exBalgMGAS0eyOPsRdwaa3O6N6uzmVuHJqj+7zY0hXXWQmpnJFAlsuSXG8s1qrXzab/M4zqVmKQNMaR5hjarJkms3cabNAGu/ohYrWKb22M483I7ozuj7NX7zEsTG+Ohd0m5+pA4rBPulBG0Fk5hitrpgnzJsymXW8kJLINHOmAFUCEL1tBRyhPHKoFd3bdEnGpS5qhQtECN/maah6eg/DSxVgympcElxYtSiRfIpNkuaQ8d8QdAiEGvolMwso2J9cvlonOd8olzsBtOpkahKTg/+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E62kTVK5mvG/7OrxGTgx4y2IJJDY1uBVgVJIZ4P374FAA7sALYOiPr1pG0/4fGDKKfG+RSaA=="
# ENV bX_For_IP="163.47.101.118"
#ENV USER_MUID="074AD7F106536BC6392FC4C907CA6AE9"
# 暴露8080端口
EXPOSE 8080
# 容器启动时运行的命令
CMD ["/workspace/app/go-proxy-bingai"] |