Unable run middleware in docker container

29 views
Skip to first unread message

mypipsydoodles

unread,
Sep 26, 2022, 12:45:06 AM9/26/22
to hoverfly
Hi,

As noted in the subject not able to get the middleware executable to run and get the error message:

Got error: Middleware failed to start
Command: "node /tmp/hoverfly/hoverfly_020817996
exec: "\"node": executable file not found in $PATH

See below for docker repo and files....

- I have logged into the container to confirm node is installed with version as see in the following output

> docker exec -it 280 sh
> / # node -v
> v16.16.0

- The script works as expected given that it just reads in stdin and immediately outputs it to stdout as shown in the following output:

> cat file.test
> "test"
> node index.js < file.test
> "test"

Is there something I am missing?


The dockerfile

FROM spectolabs/hoverfly
RUN apk --update add nodejs
COPY index.js test.json /
WORKDIR /
ENTRYPOINT ["hoverfly", "-webserver", "-listen-on-host", "0.0.0.0",  "-pp", "8080",  "-middleware=\"node ./index.js\"", "-import",  "./test.json"]


index.js

const fs = require("fs")

function main() {
var stdinBuffer = fs.readFileSync(0);
process.stdout.write(stdinBuffer.toString());
}

main()


Reply all
Reply to author
Forward
0 new messages