Spaces:
Paused
Paused
Update Dockerfile
Browse files1234567891011121314FROM golang:1.21-alpine AS builderWORKDIR /appCOPY go.mod go.sum ./RUN go mod downloadCOPY . .RUN CGO_ENABLED=0 GOOS=linux go build -o omniroute .FROM alpine:latestRUN apk --no-cache add ca-certificates tzdataWORKDIR /appCOPY --from=builder /app/omniroute .# 锁死 Hugging Face 专属端口ENV PORT=7860123456789101112131415161718192021222324252627# --- 第一阶段:让云端去 GitHub 抓代码并编译 ---FROM golang:1.21-alpine AS builder# 安装 git 客户端RUN apk add --no-cache gitWORKDIR /app# 【核心】让 Hugging Face 替你去 GitHub 拿那 5568 个文件!RUN git clone https://github.com/diegosouzapw/OmniRoute.git .# 下载依赖并编译RUN go mod downloadRUN CGO_ENABLED=0 GOOS=linux go build -o omniroute .# --- 第二阶段:极简运行环境 ---FROM alpine:latestRUN apk --no-cache add ca-certificates tzdataWORKDIR /app# 把编译好的程序和可能需要的资源拷过来COPY --from=builder /app/omniroute .# 如果官方仓库里有其它的必要文件夹(比如静态资源、配置),云端也一并拷过去:# COPY --from=builder /app/config ./config# 锁死 Hugging Face 专属端口ENV PORT=7860
Dockerfile+15-2