sfun commited on
Commit
c2ea55a
1 Parent(s): dcb6f5e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -1
Dockerfile CHANGED
@@ -1 +1,36 @@
1
- FROM deanxv/coze-discord-proxy:latest
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用 Golang 镜像作为构建阶段
2
+ FROM golang AS builder
3
+
4
+ # 设置环境变量
5
+ ENV GO111MODULE=on \
6
+ CGO_ENABLED=0 \
7
+ GOOS=linux
8
+
9
+ # 设置工作目录
10
+ WORKDIR /build
11
+
12
+ # 复制 go.mod 和 go.sum 文件,先下载依赖
13
+ COPY go.mod go.sum ./
14
+ #ENV GOPROXY=https://goproxy.cn,direct
15
+ RUN go mod download
16
+
17
+ # 复制整个项目并构建可执行文件
18
+ RUN apk add git && git clone https://github.com/deanxv/coze-discord-proxy.git .
19
+ RUN sed -i 's/router.Group("/v1")/router.Group("/api/v1")/' /router/api-router.go
20
+ RUN go build -o /coze-discord-proxy
21
+
22
+ # 使用 Alpine 镜像作为最终镜像
23
+ FROM alpine
24
+
25
+ # 安装基本的运行时依赖
26
+ RUN apk --no-cache add ca-certificates tzdata
27
+
28
+ # 从构建阶段复制可执行文件
29
+ COPY --from=builder /coze-discord-proxy .
30
+
31
+ # 暴露端口
32
+ EXPOSE 7077
33
+ # 工作目录
34
+ WORKDIR /app/coze-discord-proxy/data
35
+ # 设置入口命令
36
+ ENTRYPOINT ["/coze-discord-proxy"]