Spaces:
Building
Building
File size: 850 Bytes
fc09af9 9da907d fc09af9 9da907d fc09af9 9da907d fc09af9 9da907d fc09af9 9da907d fc09af9 9da907d fc09af9 9da907d 009c5a0 fee3b38 9da907d fc09af9 9da907d |
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 |
# 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="G4hJ9k544565uhjjhjlkjh6356223p3EaYc0FvIjHmLzXeRfAq"
# 端口
EXPOSE 8080
# 容器运行✅
CMD ["/workspace/app/go-proxy-bingai"]
|