In order to be able to build the documentation without internet access (as is required by some distribution build systems), all of the source code needed for the build needs to be available in the source tarball. This used to be possible with the docker-cli sources but was accidentally broken with some CI changes that switched to downloading the tools (by modifying go.mod as part of the docs build script). This pattern also maked documentation builds less reproducible since the tool version used was not based on the source code version. Fixes:7dc35c03fc("validate manpages target") Fixes:a650f4ddd0("switch to cli-docs-tool for yaml docs generation") Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2.3 KiB
About
This is a library containing utilities to generate (reference) documentation
for the docker CLI on docs.docker.com.
Disclaimer
This library is intended for use by Docker's CLIs, and is not intended to be a general-purpose utility. Various bits are hard-coded or make assumptions that are very specific to our use-case. Contributions are welcome, but we will not accept contributions to make this a general-purpose module.
Usage
To generate the documentation it's recommended to do so using a Go submodule in your repository.
We will use the example of docker/buildx and create a Go submodule in a
docs folder (recommended):
$ mkdir docs
$ cd ./docs
$ go mod init github.com/docker/buildx/docs
$ go get github.com/docker/cli-docs-tool
Your go.mod should look like this:
module github.com/docker/buildx/docs
go 1.16
require (
github.com/docker/cli-docs-tool v0.0.0
)
Next, create a file named main.go inside that directory containing the
following Go code from example/main.go.
Running this example should produce the following output:
$ go run main.go
INFO: Generating Markdown for "docker buildx bake"
INFO: Generating Markdown for "docker buildx build"
INFO: Generating Markdown for "docker buildx create"
INFO: Generating Markdown for "docker buildx du"
...
INFO: Generating YAML for "docker buildx uninstall"
INFO: Generating YAML for "docker buildx use"
INFO: Generating YAML for "docker buildx version"
INFO: Generating YAML for "docker buildx"
Generated docs will be available in the ./docs folder of the project.
Contributing
Want to contribute? Awesome! You can find information about contributing to this project in the CONTRIBUTING.md