v1.35.3 Latest Latest

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

Go to latest
Published: Apr 12, 2024 License: MPL-2.0 Imports: 35 Imported by: 0




This section is empty.


This section is empty.


func BuildImage

func BuildImage(ctx context.Context, spec *ImageSpec, cfg ImageBuildConfig) (v1.Image, error)

BuildImage builds a docker image from the given spec.

func ResolveRemoteImage

func ResolveRemoteImage(ctx context.Context, imageRef string) (v1.Image, error)

ResolveRemoteImage resolves the base image with the given reference. If imageRef is the empty string or "scratch" it resolves to the empty image.


type BuildInfo

type BuildInfo struct {
	// The version of Encore with which the app was compiled.
	// This is string is for informational use only, and its format should not be relied on.
	EncoreCompiler string

	// AppCommit describes the commit of the app.
	AppCommit CommitInfo

type BuildInfoSpec

type BuildInfoSpec struct {
	// The build info to include in the image.
	Info BuildInfo

	// The path in the image where the build info is written, as a JSON file.
	InfoPath ImagePath

type BundleSourceSpec

type BundleSourceSpec struct {
	Source HostPath
	Dest   ImagePath

	// Source paths to exclude from copying, relative to Source.
	ExcludeSource []RelPath

type CommitInfo

type CommitInfo struct {
	Revision    string
	Uncommitted bool

type DescribeConfig

type DescribeConfig struct {
	// The parsed metadata.
	Meta *meta.Data

	// The compile result.
	Compile *builder.CompileResult

	// The directory containing the runtimes.
	Runtimes HostPath

	// The docker base image to use, if any. If None it defaults to the empty scratch image.
	DockerBaseImage option.Option[string]

	// BundleSource specifies whether to bundle source into the image,
	// and where the source is located on the host filesystem.
	BundleSource option.Option[BundleSourceSpec]

	// BuildInfo contains information about the build.
	BuildInfo BuildInfo

type FeatureFlag

type FeatureFlag string
const (
	NewRuntimeConfig FeatureFlag = "new_runtime_config"

type HostPath

type HostPath string

HostPath is a path on the host filesystem.

func (HostPath) Dir

func (h HostPath) Dir() HostPath

func (HostPath) IsAbs

func (h HostPath) IsAbs() bool

func (HostPath) Join

func (h HostPath) Join(p ...string) HostPath

func (HostPath) JoinHost

func (h HostPath) JoinHost(p HostPath) HostPath

func (HostPath) Rel

func (h HostPath) Rel(target HostPath) (HostPath, error)

func (HostPath) String

func (h HostPath) String() string

func (HostPath) ToImage

func (h HostPath) ToImage() ImagePath

type ImageBuildConfig

type ImageBuildConfig struct {
	// The time to use when recording times in the image.
	BuildTime time.Time

	// AddCACerts, if set, specifies where in the image to mount the CA certificates.
	// If set to Some(""), defaults to DefaultCACertsPath.
	AddCACerts option.Option[ImagePath]

	// SupervisorPath is the path to the supervisor binary to use.
	// It must be set if the image includes the supervisor.
	SupervisorPath option.Option[HostPath]

	// BaseImageOverride overrides the base image to use.
	// If None it resolves the image from the spec using ResolveRemoteImage.
	BaseImageOverride option.Option[v1.Image]

type ImageManifest

type ImageManifest struct {
	// The Docker Image reference, e.g. ""
	Reference string

	// Services and gateways bundled in this image.
	BundledServices []string
	BundledGateways []string

	// FeatureFlags captures feature flags enabled for this image.
	FeatureFlags map[FeatureFlag]bool

type ImageManifestFile

type ImageManifestFile struct {
	Manifests []*ImageManifest

type ImagePath

type ImagePath string

ImagePath is a path in the docker image.

const DefaultCACertsPath ImagePath = "/etc/ssl/certs/ca-certificates.crt"

DefaultCACertsPath is the default path for where to write CA Certs. From

func (ImagePath) Clean

func (i ImagePath) Clean() ImagePath

func (ImagePath) Dir

func (i ImagePath) Dir() ImagePath

func (ImagePath) Join

func (i ImagePath) Join(p ...string) ImagePath

func (ImagePath) JoinImage

func (i ImagePath) JoinImage(p ImagePath) ImagePath

func (ImagePath) String

func (i ImagePath) String() string

type ImageSpec

type ImageSpec struct {
	// The entrypoint to use for the image. It must be non-empty.
	// The first entry is the executable path, and the rest are the arguments.
	Entrypoint []string

	// Environment variables to set for the entrypoint.
	Env []string

	// The working dir to use for executing the entrypoint.
	WorkingDir ImagePath

	// BuildInfo contains information about the build.
	BuildInfo BuildInfoSpec

	// A map from the builder filesystem paths to the destination path in the image.
	// If the source is a directory, it will be copied recursively.
	CopyData map[ImagePath]HostPath

	// Whether to bundle source into the image.
	// It's handled separately from CopyData since we apply some filtering
	// on what's copied, like excluding .git directories and other build artifacts.
	BundleSource option.Option[BundleSourceSpec]

	// Supervisor specifies the supervisor configuration.
	Supervisor option.Option[SupervisorSpec]

	// The names of services bundled in this image.
	BundledServices []string

	// The names of gateways bundled in this image.
	BundledGateways []string

	// The docker base image to use. If None it defaults to the empty scratch image.
	DockerBaseImage string

	// StargzPrioritizedFiles are file paths in the image that should be prioritized for
	// stargz compression, allowing for faster streaming of those files.
	StargzPrioritizedFiles []ImagePath

	// FeatureFlags specifies feature flags enabled for this image.
	FeatureFlags map[FeatureFlag]bool

	// The app metadata, protobuf encoded.
	Meta []byte

ImageSpec is a specification for how to build a docker image.

func Describe

func Describe(cfg DescribeConfig) (*ImageSpec, error)

Describe describes the docker image to build.

type ImageSpecFile

type ImageSpecFile struct {
	Images []*ImageSpec

type RelPath

type RelPath string

RelPath is a relative path.

type SupervisorSpec

type SupervisorSpec struct {
	// Where to mount the supervisor binary in the image.
	MountPath ImagePath

	// Where to write the supervisor configuration in the image.
	ConfigPath ImagePath

	// The config to pass to the supervisor.
	Config *supervisor.Config

Jump to

Keyboard shortcuts

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