|
|
|
FROM golang:alpine AS builder |
|
|
|
|
|
RUN apk update && apk add --no-cache git upx make sed |
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" checkout |
|
|
|
|
|
RUN rm -rf * && git clone https://github.com/ycvk/monica-proxy.git . \ |
|
&& rm -rf .git |
|
|
|
|
|
RUN sed -i 's#e.POST("/v1/chat/completions", handleChatCompletion)#e.POST("/hf/v1/chat/completions", handleChatCompletion)#g' internal/apiserver/router.go && \ |
|
sed -i 's#e.GET("/v1/models", handleListModels)#e.GET("/hf/v1/models", handleListModels)#g' internal/apiserver/router.go |
|
|
|
|
|
ARG TARGETOS |
|
ARG TARGETARCH |
|
RUN go mod tidy |
|
RUN make build-${TARGETOS}-${TARGETARCH} |
|
|
|
|
|
FROM scratch AS final |
|
WORKDIR /data |
|
COPY --from=builder /app/build/monica . |
|
EXPOSE 8080 |
|
CMD ["./monica"] |
|
|