Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +5 -17
Dockerfile
CHANGED
|
@@ -4,8 +4,7 @@ FROM golang:alpine AS builder
|
|
| 4 |
# 设置环境变量
|
| 5 |
ENV GO111MODULE=on \
|
| 6 |
CGO_ENABLED=0 \
|
| 7 |
-
GOOS=linux
|
| 8 |
-
PORT=7860
|
| 9 |
|
| 10 |
|
| 11 |
|
|
@@ -14,21 +13,10 @@ WORKDIR /build
|
|
| 14 |
|
| 15 |
|
| 16 |
# 安装 git
|
| 17 |
-
RUN apk add --no-cache git
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
# 添加修改路由的命令
|
| 25 |
-
RUN sed -i 's|router.Group("/v1")|router.Group("/hf/v1")|' router/api-router.go
|
| 26 |
-
|
| 27 |
-
# 直接执行依赖下载
|
| 28 |
-
RUN go mod download
|
| 29 |
-
|
| 30 |
-
# 不需要再COPY . . 因为文件已经通过git clone获取了
|
| 31 |
-
RUN go build -o /genspark2api
|
| 32 |
|
| 33 |
# 使用 Alpine 镜像作为最终镜像
|
| 34 |
FROM alpine
|
|
|
|
| 4 |
# 设置环境变量
|
| 5 |
ENV GO111MODULE=on \
|
| 6 |
CGO_ENABLED=0 \
|
| 7 |
+
GOOS=linux
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
# 安装 git
|
| 16 |
+
RUN apk add --no-cache git \
|
| 17 |
+
&& git clone https://github.com/deanxv/genspark2api.git . \
|
| 18 |
+
&& sed -i 's|router.Group("/v1")|router.Group("/hf/v1")|' router/api-router.go \
|
| 19 |
+
&& go mod download && go build -o /genspark2api
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# 使用 Alpine 镜像作为最终镜像
|
| 22 |
FROM alpine
|