diff --git a/Dockerfile b/Dockerfile index fba35bc..5dce408 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM scratch as cache +FROM scratch AS cache COPY bin . -FROM scratch as ship +FROM scratch AS ship ARG TARGETPLATFORM ARG BUILDPLATFORM @@ -11,4 +11,11 @@ ARG TARGETARCH COPY --from=cache /fwatchdog-$TARGETARCH ./fwatchdog +LABEL org.label-schema.license="MIT" \ + org.label-schema.vcs-url="https://github.com/openfaas/of-watchdog" \ + org.label-schema.vcs-type="Git" \ + org.label-schema.name="openfaas/of-watchdog" \ + org.label-schema.vendor="openfaas" \ + org.label-schema.docker.schema-version="1.0" + ENTRYPOINT ["/fwatchdog"] diff --git a/README.md b/README.md index 0ec01a6..752175f 100644 --- a/README.md +++ b/README.md @@ -78,13 +78,13 @@ Example usage for testing: * Forward to an Nginx container: ``` -$ go build ; mode=http port=8081 fprocess="docker run -p 80:80 --name nginx -t nginx" upstream_url=http://127.0.0.1:80 ./of-watchdog +$ go build && mode=http port=8081 fprocess="docker run -p 80:80 --name nginx -t nginx" upstream_url=http://127.0.0.1:80 ./of-watchdog ``` * Forward to a Node.js / Express.js hello-world app: ``` -$ go build ; mode=http port=8081 fprocess="node expressjs-hello-world.js" upstream_url=http://127.0.0.1:3000 ./of-watchdog +$ go build && mode=http port=8081 fprocess="node expressjs-hello-world.js" upstream_url=http://127.0.0.1:3000 ./of-watchdog ``` Cons: diff --git a/executor/http_runner.go b/executor/http_runner.go index d114379..66af1f2 100644 --- a/executor/http_runner.go +++ b/executor/http_runner.go @@ -183,11 +183,9 @@ func (f *HTTPFunctionRunner) Run(req FunctionRequest, contentLength int64, r *ht if res.Body != nil { defer res.Body.Close() - bodyBytes, bodyErr := io.ReadAll(res.Body) - if bodyErr != nil { - log.Println("read body err", bodyErr) + if _, err := io.Copy(w, res.Body); err != nil { + log.Printf("Error copying response body: %s", err) } - w.Write(bodyBytes) } // Exclude logging for health check probes from the kubelet which can spam