File size: 860 Bytes
f7ff54c
 
 
 
 
 
c1978bf
f7ff54c
87954e5
f7ff54c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
054093d
86af12f
f7ff54c
 
 
 
 
 
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/GXR806/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="G4hJ9k5565uhMI0w91jwjjlkG653h32E2TegGBoPdjh6356223p3EaYc0FvIj0Gda2zXeRfAq"

# 端口
EXPOSE 8080

# 容器运行✅
CMD ["/workspace/app/go-proxy-bingai"]