File size: 681 Bytes
af676b0
 
 
 
 
 
 
 
 
 
e8951a6
 
 
af676b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 使用适合Go应用的基础镜像
FROM golang:alpine AS builder
ARG TARGETOS
ARG TARGETARCH
RUN apk update && apk add --no-cache upx make git && rm -rf /var/cache/apk/* 
RUN git clone https://github.com/ycvk/monica-proxy.git /app

# 设置工作目录
WORKDIR /app

RUN sed -i 's/\/v1\/chat\/completions/\/hf\/v1\/chat\/completions/g' internal/apiserver/router.go
RUN sed -i 's/\/v1\/models/\/hf\/v1\/models/g' internal/apiserver/router.go

# 下载依赖
RUN go mod tidy

# 构建应用程序
RUN make build-${TARGETOS}-${TARGETARCH}

FROM scratch AS final
WORKDIR /data
COPY --from=builder /app/build/monica /data/monica

# 开放端口
EXPOSE 8080

# 运行
CMD ["./monica"]