containerbuild

package
v0.0.0-...-e7d376f Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package containerbuild provides the implementation of the ContainerBuild command, which builds a container image from a Dockerfile and tags it with the provided name and tags.

Package containerbuild implements the "build" subcommand, which builds an OCI image using the docker CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(ctx context.Context, cmd *cli.Command) error

Action is the build subcommand entry point. Pipeline: validate tags → acquire dockerfile → render args → run process → release.

func Command

func Command() *cli.Command

func EmbeddedResolver

func EmbeddedResolver() IOE.IOEither[error, DockerfileResource]

EmbeddedResolver writes the compile-time embedded Dockerfile content to a temp file and returns a DockerfileResource whose Release removes that file.

func Execute

func Execute(r Input) IOE.IOEither[error, F.Void]

Execute orchestrates the full build lifecycle using ioeither.WithResource. Delegates to executeWith for testability.

func FileResolver

func FileResolver(path string) IOE.IOEither[error, DockerfileResource]

FileResolver validates that path is non-blank, then wraps it in a DockerfileResource with nop cleanup.

func ValidateInput

func ValidateInput(r Input) E.Either[error, Input]

ValidateInput checks that the tags in the Input are valid according to

Types

type CommandSpec

type CommandSpec struct {
	Bin  string
	Args []string
}

CommandSpec holds the resolved executable binary and argv slice. Built inside Execute after the DockerfileResource is acquired.

func RenderCommand

func RenderCommand(r Input, path string) CommandSpec

RenderCommand is a pure function that builds a CommandSpec from an Input and a resolved Dockerfile path. Called inside Execute after the DockerfileResource is acquired.

type DockerfileResource

type DockerfileResource struct {
	Path    string
	Release IOE.IOEither[error, string]
}

DockerfileResource pairs a resolved Dockerfile path with its cleanup IOEither. For file-based builds cleanup is a nop; for embedded builds it removes the temp file via IOEF.Remove.

type Input

type Input struct {
	DockerfileSource IOE.IOEither[error, DockerfileResource]
	Name             string
	Tags             []string
	BuildArgs        map[string]string
	Ctx              context.Context
}

Input holds the build parameters throughout the pipeline. DockerfileSource is a lazy IOEither that resolves to a DockerfileResource when executed. It is set once in InputFromCommand and never branched on.

func InputFromCommand

func InputFromCommand(ctx context.Context, cmd *cli.Command) Input

InputFromCommand reads CLI flags and constructs the build Input using Record-based dispatch for both Dockerfile source and build args.

Jump to

Keyboard shortcuts

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