javaeeduke commited on
Commit
01e6a7a
·
verified ·
1 Parent(s): 7bffa9f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -2
Dockerfile CHANGED
@@ -1,14 +1,27 @@
 
1
  FROM golang:1.21-alpine AS builder
 
 
 
 
2
  WORKDIR /app
3
- COPY go.mod go.sum ./
 
 
 
 
4
  RUN go mod download
5
- COPY . .
6
  RUN CGO_ENABLED=0 GOOS=linux go build -o omniroute .
7
 
 
8
  FROM alpine:latest
9
  RUN apk --no-cache add ca-certificates tzdata
10
  WORKDIR /app
 
 
11
  COPY --from=builder /app/omniroute .
 
 
12
 
13
  # 锁死 Hugging Face 专属端口
14
  ENV PORT=7860
 
1
+ # --- 第一阶段:让云端去 GitHub 抓代码并编译 ---
2
  FROM golang:1.21-alpine AS builder
3
+
4
+ # 安装 git 客户端
5
+ RUN apk add --no-cache git
6
+
7
  WORKDIR /app
8
+
9
+ # 【核心】让 Hugging Face 替你去 GitHub 拿那 5568 个文件!
10
+ RUN git clone https://github.com/diegosouzapw/OmniRoute.git .
11
+
12
+ # 下载依赖并编译
13
  RUN go mod download
 
14
  RUN CGO_ENABLED=0 GOOS=linux go build -o omniroute .
15
 
16
+ # --- 第二阶段:极简运行环境 ---
17
  FROM alpine:latest
18
  RUN apk --no-cache add ca-certificates tzdata
19
  WORKDIR /app
20
+
21
+ # 把编译好的程序和可能需要的资源拷过来
22
  COPY --from=builder /app/omniroute .
23
+ # 如果官方仓库里有其它的必要文件夹(比如静态资源、配置),云端也一并拷过去:
24
+ # COPY --from=builder /app/config ./config
25
 
26
  # 锁死 Hugging Face 专属端口
27
  ENV PORT=7860