Documentation
¶
Overview ¶
Package image builds container images and pushes them to a registry. It returns the pushed digest, so a deploy runs exactly the image it built.
Index ¶
Constants ¶
const DefaultPlatform = "linux/amd64"
DefaultPlatform is what managed container services run.
Variables ¶
This section is empty.
Functions ¶
func BuildAndPush ¶
BuildAndPush runs `docker buildx build --push` and returns the pushed image as repository@sha256:digest.
func MovingTag ¶ added in v0.3.1
MovingTag reports whether an image reference names a tag that is expected to move, and which tag that is. A reference with a digest never moves. Without one, no tag at all means "latest", and a tag with no digit in it ("latest", "main", "stable") reads as a channel or a branch rather than a version.
A deploy from a moving tag runs whatever the tag points at when the platform pulls it, which behind a caching registry can be an image from days ago.
func Registry ¶ added in v0.4.0
Registry splits an image reference into the host it is pulled from and the rest. A reference that names no host, such as "nginx:1.27" or "acme/shop", is on Docker Hub.
func WriteGenerated ¶
func WriteGenerated(dir, name string, g *dockerfile.Result) (string, error)
WriteGenerated writes a generated Dockerfile and its ignore file into dir as <name>.Dockerfile, and returns the Dockerfile's path. BuildKit reads the ignore file from next to the Dockerfile.
Types ¶
type Build ¶
type Build struct {
// Context is the build context directory.
Context string
// Dockerfile is the path of the Dockerfile to build.
Dockerfile string
// Repository is the image name without a tag, e.g. us-docker.pkg.dev/p/r/app-web.
Repository string
// Tag is the tag pushed alongside the digest; "latest" when empty.
Tag string
Platform string
}