kontext

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 17 Imported by: 1

README

kontext

A library for building self-extracting container images

Documentation

Overview

Package kontext is a set of utilities for bundling up a local directory context within CLIs into a self-extracting container image that when run will expand its payload into the working directory. It is (originally) based on github.com/mattmoor/kontext

Index

Constants

View Source
const (
	// StoragePath is where in the container image the files are placed.
	StoragePath = "/var/run/kontext"
)

Variables

View Source
var (
	// BaseImageString holds a reference to a built image of ./cmd/expander
	BaseImageString = "ghcr.io/chainguard-dev/kontext:latest"
	// BaseImage is where we publish ./cmd/expander
	BaseImage, _ = name.ParseReference(BaseImageString)
)

Functions

func Bundle

func Bundle(ctx context.Context, directory string, tag name.Tag) (name.Digest, error)

Bundle packages up the given directory as a self-extracting container image based on BaseImage and publishes it to tag.

func Expand

func Expand(ctx context.Context) error

Expand recursively copies the current working directory into StoragePath.

func Map

func Map(ctx context.Context, base name.Reference, tag name.Tag, fn Mutator) (name.Digest, error)

Map loads the base reference, applies the Mutator function to all of the images contained within, and publishes it to tag. The digest of the resulting image or image index is returned upon success, or an error on failure.

Types

type Mutator

type Mutator func(ctx context.Context, img v1.Image) (v1.Image, error)

Mutator is the signature of the callback supplied to Map. This function will be called on each of the images that comprise the referenced base, and the function maybe be called once (if an image) or many times (is an image index).

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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