image

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(
	ctx context.Context,
	cfg *config.Config,
	dir,
	imageName string,
	configFilename string,
	secrets []string,
	noCache,
	separateWeights bool,
	useCudaBaseImage string,
	progressOutput string,
	schemaFile string,
	dockerfileFile string,
	useCogBaseImage *bool,
	strip bool,
	precompile bool,
	excludeSource bool,
	skipSchemaValidation bool,
	skipLabels bool,
	annotations map[string]string,
	dockerCommand command.Command,
	client registry.Client) (string, error)

Build a Cog model from a config and returns the image ID (sha256:...) on success.

This is separated out from docker.Build(), so that can be as close as possible to the behavior of 'docker build'.

func BuildAddLabelsAndSchemaToImage added in v0.14.9

func BuildAddLabelsAndSchemaToImage(ctx context.Context, dockerClient command.Command, tmpName, image string, labels map[string]string, bundledSchemaFile string, progressOutput string) (string, error)

BuildAddLabelsAndSchemaToImage builds a cog model with labels and schema. Returns the image ID (sha256:...) of the final image.

The new image is based on the provided image with the labels and schema file appended to it. tmpName is the source image to build from, image is the final image name/tag.

func CogConfigFromManifest added in v0.14.8

func CogConfigFromManifest(ctx context.Context, manifest *image.InspectResponse) (*config.Config, error)

func GenerateOpenAPISchema added in v0.1.0

func GenerateOpenAPISchema(ctx context.Context, dockerClient command.Command, imageName string, enableGPU bool, sourceDir string) (map[string]any, error)

GenerateOpenAPISchema generates the OpenAPI schema by running the built Docker image with `python -m cog.command.openapi_schema`. This is the legacy path used for SDK versions < 0.17.0 where the schema must be generated at runtime via pydantic introspection rather than static analysis.

sourceDir, when non-empty, is volume-mounted as /src. This is needed for ExcludeSource builds (cog serve/predict/train) where COPY . /src was skipped.

func GeneratePipFreeze added in v0.13.3

func GeneratePipFreeze(ctx context.Context, dockerClient command.Command, imageName string) (string, error)

GeneratePipFreeze by running a pip freeze on the image. This will be run as part of the build process then added as a label to the image.

Types

This section is empty.

Jump to

Keyboard shortcuts

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