I am working to add GitHub Codespaces to the NUnit docs repository for document editing. We're really excited about the potential of Codespaces for our use case!
The Current Ingredients
- PR to add codespaces, which has our configuration files and containers: https://github.com/nunit/docs/pull/563
- The source of the Dockerfile we're referencing from our Codespaces Dockerfile: https://github.com/nunit/docfx-action/blob/master/Dockerfile
Reproduction
- Open the codespace
- Open the terminal
cd docs
docfx build
- builds successfully, as expecteddocfx serve
- indicates it is serving on port8080
, as expected- Follow the link from the terminal, which opens the port
8080
in a forwarded tab
Expected Behavior
See the site at the root site at the /_site
subdirectory which is where docfx serves items
Actual Behavior
See a 502 bad gateway error at the initial URL, and also when attempting with /_site
appended.
Other Things I've tried
- I've pulled this branch in VS Code on my machine and opened it in this container. I was able to see the site served as expected on both the forwarded
8080
port root and with/_site
appended.
I figured it out! Thanks to this comment: https://github.com/dotnet/docfx/issues/3615#issuecomment-451664865
In this case, because docfx is using
WebApp.Start()
, the correct syntax inside of the container is:docfx serve _site -n "*"
That
"*"
is what makes the difference here and allows mono to bind appropriately for the forwarding to work.