Spaces:
Sleeping
Sleeping
# 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 | |
# 编译 go 项目。-ldflags="-s -w" 是为了减少编译后的二进制大小 | |
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="Y3VybCAnaHR0cHM6Ly93d3cuYmluZy5jb20vdHVyaW5nL2NhcHRjaGEvY2hhbGxlbmdlJyBcICAgLUggJ2F1dGhvcml0eTogd3d3LmJpbmcuY29tJyBcICAgLUggJ2FjY2VwdDogdGV4dC9odG1sLGFwcGxpY2F0aW9uL3hodG1sK3htbCxhcHBsaWNhdGlvbi94bWw7cT0wLjksaW1hZ2UvYXZpZixpbWFnZS93ZWJwLGltYWdlL2FwbmcsKi8qO3E9MC44LGFwcGxpY2F0aW9uL3NpZ25lZC1leGNoYW5nZTt2PWIzO3E9MC43JyBcICAgLUggJ2FjY2VwdC1sYW5ndWFnZTogemgtQ04semg7cT0wLjksZW47cT0wLjgsamE7cT0wLjcsemgtVFc7cT0wLjYsZnI7cT0wLjUsZXM7cT0wLjQsbmI7cT0wLjMnIFwgICAtSCAnY2FjaGUtY29udHJvbDogbm8tY2FjaGUnIFwgICAtSCAnY29va2llOiBfRURHRV9WPTE7IE1VSUQ9MTI0NUY4QUJBNUFENjM4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