From 84ce06a20616a5ddaf9aec55698aa713341a2dfb Mon Sep 17 00:00:00 2001 From: Tiago Santos Date: Tue, 25 Jun 2024 17:14:36 +0100 Subject: [PATCH] fix: add missing endpoint url path to request and make image non-root --- Dockerfile | 4 +++- azure/model.go | 2 +- build.sh | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4f788ac..bbce7ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,6 @@ WORKDIR /app EXPOSE 8080 COPY --from=builder /builder/bin . -ENTRYPOINT ["/app/azure-openai-proxy"] \ No newline at end of file +USER 1000:1000 + +ENTRYPOINT ["/app/azure-openai-proxy"] diff --git a/azure/model.go b/azure/model.go index cc23abf..21df8b9 100644 --- a/azure/model.go +++ b/azure/model.go @@ -42,7 +42,7 @@ func (c *StripPrefixConverter) Convert(req *http.Request, config *DeploymentConf req.Host = config.EndpointUrl.Host req.URL.Scheme = config.EndpointUrl.Scheme req.URL.Host = config.EndpointUrl.Host - req.URL.Path = path.Join(fmt.Sprintf("/openai/deployments/%s", config.DeploymentName), strings.Replace(req.URL.Path, c.Prefix+"/", "/", 1)) + req.URL.Path = path.Join(config.EndpointUrl.Path, fmt.Sprintf("/openai/deployments/%s", config.DeploymentName), strings.Replace(req.URL.Path, c.Prefix+"/", "/", 1)) req.URL.RawPath = req.URL.EscapedPath() query := req.URL.Query() diff --git a/build.sh b/build.sh index 922d2e0..0cebaf3 100644 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ set -e -VERSION=v1.1.0 +VERSION=v1.3.10 rm -rf bin @@ -10,4 +10,4 @@ export GOOS=linux export GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o bin/azure-openai-proxy ./cmd -docker build -t stulzq/azure-openai-proxy:$VERSION . \ No newline at end of file +docker buildx build --platform linux/amd64 -t stulzq/azure-openai-proxy:$VERSION .