9269d71907
A step that runs `go install <tool>@<version>` and then invokes the tool fails with exit 127: the binary lands in $GOPATH/bin, which nothing adds to PATH, and GOPATH defaults to /root/go. Pipelines moving here from docker.io/golang, where /go/bin is on PATH, break on that difference. - Set GOPATH=/go and prepend /go/bin to PATH, matching the official golang images. - Create /go/bin mode 1777 so go install also works if the image runs as non-root. - Document the installed-tool contract in the README.
35 lines
1.5 KiB
Markdown
35 lines
1.5 KiB
Markdown
# container-gobuilder
|
|
|
|
The estate's Go toolchain image, built on each `container-base` distro image.
|
|
Published as `artifactapi.k8s.syd1.au.unkin.net/docker-internal/gobuilder:<version>-<suffix>`;
|
|
the default distro's build is retagged as the unsuffixed `:<version>`, so both resolve
|
|
to one digest. Only explicit versions are published; never a floating tag.
|
|
|
|
| distro | from | tag suffix | default |
|
|
| --- | --- | --- | --- |
|
|
| `alma9` | `docker-internal/almalinux9:<base version>` | `alma9` | yes |
|
|
|
|
Adds `golang`, `gcc` and `nfpm`, and bakes in the `go-cache-plugin` binary on `PATH`
|
|
so Go pipelines get the shared build cache with no download step. No credentials and no
|
|
`GOCACHEPROG` value are baked in — consumers set those.
|
|
|
|
`GOPATH` is `/go` with `/go/bin` on `PATH`, as on the official `golang` images, so a tool
|
|
installed with `go install <tool>@<version>` is runnable by name in the same step.
|
|
|
|
The `container-base` release this image builds on is `BASE_VERSION` in the `Dockerfile`.
|
|
|
|
## Adding a distro
|
|
|
|
1. `distros/<name>/distro.env` — `BASE_IMAGE_NAME`, `IMAGE`, `TAG_SUFFIX`, `DEFAULT`, `PACKAGES`, `GO_MIN`.
|
|
2. One `include` entry in each of `.woodpecker/{build,docker}.yaml`.
|
|
|
|
The `check-distros` pre-commit hook fails if step 1 or 2 is incomplete, or if more than
|
|
one distro claims `DEFAULT`.
|
|
|
|
## Make
|
|
|
|
make build # build every distro
|
|
make pre-commit # uvx pre-commit run --all-files
|
|
make build-alma9 # one distro
|
|
make patch|minor|major
|