A local Go pkgsite serving the module documentation, with automatic browser refresh.
"features": {
"ghcr.io/thediveo/devcontainer-features/local-pkgsite:1": {}
}| Options Id | Description | Type | Default Value |
|---|---|---|---|
| port | TCP port serving packages documentation | string | 6060 |
| reload-delay | time in milliseconds to delay the reload event following file changes | string | 2000 |
| reload-debounce | time in milliseconds to restrict the frequency in which browser:reload events can be emitted to connected clients | string | 5000 |
This feature has a soft dependecy on ghcr.io/devcontainers/features/go so that
you have full control over from where and how you bring in the go toolchain.
Similar, it has a soft dependency on ghcr.io/devcontainers/features/node –
depending on you base image you already have a suitable node, otherwise you
might want to also reference the above node feature.
For example:
{
"features": {
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/node:2": {}, // unless base image has node
"ghcr.io/thediveo/devcontainer-features/local-pkgsite:1": {}
}
}Tested with:
- ghcr.io/almalinux/almalinux,
- mcr.microsoft.com/devcontainers/base:debian,
- fedora,
- mcr.microsoft.com/devcontainers/base:ubuntu.
@mdaverde for his blog post Build your Golang package docs locally that forms the basis for this devcontainer feature.
The port configured with the port option is served by
browser-sync, and browser-sync
in turn proxies pkgsite. pkgsite is started with a random port from the
ephemeral port
range, this random
port is determined once when the devcontainer starts and then kept constant.
nodemon monitors your Go sources
for changes and then triggers a browser refresh and pkgsite restart.
Note: This file was auto-generated from the devcontainer-feature.json. Add additional notes to a NOTES.md.