build

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package build renders Dockerfiles for layered presets, computes deterministic image tags, and invokes `docker build` to materialize them.

Index

Constants

View Source
const ImageNamePrefix = "drun"

ImageNamePrefix is the local image namespace used for built layer images.

Variables

This section is empty.

Functions

func Dockerfile

func Dockerfile(p config.Preset) string

Dockerfile renders the Dockerfile contents for a preset.

func EnsureImage

func EnsureImage(name string, p config.Preset) (string, error)

EnsureImage builds the layer image if not present and returns the tag to run.

func ImageExists

func ImageExists(tag string) bool

ImageExists returns true if the local docker daemon has the given tag.

func LatestRef added in v0.2.0

func LatestRef(ref string) string

LatestRef rewrites an image reference so it points at the `:latest` tag of the same repository, stripping any existing tag and/or digest. Registry host and port are preserved. The returned ref always ends in ":latest".

alpine                                 -> alpine:latest
golang:1.24-alpine                     -> golang:latest
ghcr.io/foo/bar:canary                 -> ghcr.io/foo/bar:latest
registry.local:5000/foo/bar:v1         -> registry.local:5000/foo/bar:latest
foo@sha256:abcd                        -> foo:latest
ghcr.io/foo/bar:v1@sha256:abcd         -> ghcr.io/foo/bar:latest

func NeedsBuild

func NeedsBuild(p config.Preset) bool

NeedsBuild reports whether the preset declares any layer.

func ResolveLatestDigest added in v0.2.0

func ResolveLatestDigest(ref string) (string, error)

ResolveLatestDigest pulls the given ref (expected to be `<repo>:latest`) and returns a digest-pinned reference of the form `<repo>@sha256:...`. This lets callers feed the ref into `Tag`/`hash` so that as upstream `:latest` moves, the resulting layer image tag changes too — without forcing a rebuild when nothing upstream actually changed between runs.

func Tag

func Tag(name string, p config.Preset) string

Tag computes the deterministic local image tag for a preset.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL