Go websocket not working in oathkeeper example
Preflight checklist
- [X] I could not find a solution in the existing issues, docs, nor discussions.
- [X] I agree to follow this project's Code of Conduct.
- [X] I have read and am following this repository's Contribution Guidelines.
- [ ] This issue affects my Ory Network project.
- [ ] I have joined the Ory Community Slack.
- [ ] I am signed up to the Ory Security Patch Newsletter.
Describe the bug
The go websocket container called ws in the oathkeeper example fails to build. The logs are saying that the executable in the Dockerfile's entrypoint doesn't exist.
Reproducing the bug
- Run
cd code-examples/oathkeeper - Run
docker compose up --build - Go to http://127.0.0.1:4455 and create an account
- Go to http://127.0.0.1:8080
Relevant log output
Attaching to oathkeeper-kratos-1, oathkeeper-kratos-migrate-1, oathkeeper-kratos-selfservice-ui-node-1, oathkeeper-mailslurper-1, oathkeeper-oathkeeper-1, oathkeeper-postgres-kratos-1, oathkeeper-ws-1
oathkeeper-ws-1 | exec /ws: no such file or directory
oathkeeper-mailslurper-1 | time="2022-11-22T23:44:31Z" level=info msg="Starting MailSlurper Server v1.14.1" who=MailSlurper
Relevant configuration
No response
Version
master
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Docker Compose
Additional Context
I ran it on WSL but it failed on Docker Desktop for Windows too.
I'm not very proficient at golang, but it seems like the problem is that the go build is made at a stage with a 'golang' base image, but is then run on a different 'alpine' image. I managed to make it work by doing everything in a 'golang:alpine' image like so: `FROM golang:alpine
RUN mkdir /build
ADD . /build
WORKDIR /build
RUN GOOS=linux GOARCH=amd64 go build -o ws main.go
EXPOSE 8090
CMD ["/build/ws"]`
Another fix is to switch out the image used in the second stage to debian.
Are there any plans to fix the guide though?