|
|
|
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"] |