Documentation
¶
Overview ¶
Package image is `pstack build-image` — build the control image from the running binary itself.
WHY THIS EXISTS. `pstack init` requires the control image to exist locally and deliberately does not pull. A CLI that cannot produce the one artefact it requires is a broken install, so the image is built HERE, from what is already on the host: pstack is one static binary, and the control image is that binary on a slim base with the docker CLI beside it. No checkout, no registry, and no second download — the image carries exactly the version that built it.
The Dockerfile INSTALLS this exact version inside the build, with the same `install.sh` an operator runs — an EMPTY context, so the build needs nothing on the host but docker, and it works from macOS because the build itself runs Linux. `PSTACK_BINARY=<path>` copies a local binary in instead, for a version that is not published yet or a host with no network.
The advanced UI image is unchanged in principle: the SPA package is a BUILD-TIME input fetched from npm inside the build, so docker — not the host — needs a JavaScript runtime. `--ui-dist` keeps the old behaviour of building from local files, for developing a change that is not published yet.
Index ¶
Constants ¶
const DefaultHearthUIImageTag = "pstack-ui-hearth:local"
DefaultHearthUIImageTag matches PSTACK_UI_HEARTH_IMAGE's default in `init`.
const DefaultImageTag = "pstack:local"
DefaultImageTag is the control image's tag.
const DefaultUIImageTag = "pstack-ui:local"
DefaultUIImageTag matches PSTACK_UI_IMAGE's default in `init`, so `build-image --ui` then `init --ui advanced` need no flags between them.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(opts BuildOptions) error
Build assembles a build context from the installed bundle and builds the image.
The context is a temp directory rather than the install directory: an install may live somewhere read-only (or shared between projects), and writing a Dockerfile into a package's own directory would mutate an installed dependency. It is removed even on failure — a half-built context left in /tmp is the sort of litter nobody goes looking for.
func ControlDockerfile ¶
ControlDockerfile is the control image: the pstack binary on debian:bookworm-slim with bash (hooks are bash), ca-certificates and curl (the installer, ACME, webhooks), and the docker CLI + compose plugin lifted from the official image.
Pinned to the running CLI's version so the image and the CLI that rendered it cannot disagree. The context is empty: the Dockerfile installs this version with the release's install.sh. localControlDockerfile is the variant that COPYs a binary from the context instead.
func DefaultUITag ¶ added in v0.43.0
DefaultUITag is the tag for a UI app's image: "hearth" or (anything else) "advanced".
func UIDockerfile ¶
UIDockerfile is a UI image (advanced or hearth): nginx over the published SPA package. Also builds with an empty context.
Types ¶
type BuildOptions ¶
type BuildOptions struct {
Tag string
Runner exec.Runner
DryRun bool
// UIApp builds a UI image instead of the control-plane image: "advanced" or "hearth" ("" = control).
UIApp string
// UIDist is an explicit path to a built UI `dist/`, for when the package is installed somewhere unusual.
UIDist string
// Binary is a Linux binary to COPY into the image instead of installing the release
// (PSTACK_BINARY). Default: none — the Dockerfile installs this version itself. A test passes
// any file.
Binary string
// Out is where progress lines go (stdout when nil).
Out io.Writer
}
BuildOptions are build-image's inputs.