Spaces:
Sleeping
Sleeping
File size: 543 Bytes
a9843a3 |
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 |
# 构建阶段
FROM golang:1.21-alpine AS builder
# 安装必要的构建工具
RUN apk add --no-cache git
# 设置工作目录
WORKDIR /build
# 复制源代码
COPY . .
# 构建应用
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gemini-relay .
# 运行阶段
FROM alpine:latest
# 安装ca证书,用于HTTPS请求
RUN apk --no-cache add ca-certificates
WORKDIR /root/
# 从构建阶段复制二进制文件
COPY --from=builder /build/gemini-relay .
# 暴露端口
EXPOSE 8080
# 运行应用
CMD ["./gemini-relay"] |