Documentation
¶
Index ¶
- func ResolveRemoteImage(ctx context.Context, imageRef string, options ...remote.Option) (v1.Image, error)
- type BuildInfo
- type BuildInfoSpec
- type BundleSourceSpec
- type CommitInfo
- type DescribeConfig
- type FeatureFlag
- type HostPath
- func (h HostPath) Dir() HostPath
- func (h HostPath) IsAbs() bool
- func (h HostPath) Join(p ...string) HostPath
- func (h HostPath) JoinHost(p HostPath) HostPath
- func (h HostPath) Rel(target HostPath) (HostPath, error)
- func (h HostPath) String() string
- func (h HostPath) ToImage() ImagePath
- func (h HostPath) ToUnix() HostPath
- type Image
- type ImageBuildConfig
- type ImageManifest
- type ImageManifestFile
- type ImagePath
- type ImageSpec
- type ImageSpecFile
- type RelPath
- type SupervisorSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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 BundleSourceSpec ¶
type BundleSourceSpec struct {
Source HostPath
Dest ImagePath
// Source paths to exclude from copying, relative to Source.
ExcludeSource []RelPath
// Path to app root, will be included, relative to Source.
AppRootRelpath RelPath
// Extra source paths to include when bundling, relative to Source.
IncludeSource []RelPath
}
type CommitInfo ¶
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 path to the node runtime, if any.
NodeRuntime option.Option[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]
// WorkingDir specifies the working directory to start the docker image in.
WorkingDir option.Option[ImagePath]
// BuildInfo contains information about the build.
BuildInfo BuildInfo
// ProcessPerService specifies whether to run each service in a separate process.
ProcessPerService bool
}
type FeatureFlag ¶
type FeatureFlag string
const (
NewRuntimeConfig FeatureFlag = "new_runtime_config"
)
type Image ¶ added in v1.58.5
Image owns the temporary compressed blobs for its newly built layers. Call Close after all exports, uploads and layer readers have finished. Base image layers retain their original storage and are not owned by Image.
func BuildImage ¶
BuildImage builds a docker image from the given spec. The caller must Close the returned image after all exports, uploads and layer readers have finished.
type ImageBuildConfig ¶
type ImageBuildConfig struct {
// The time to use when recording times in the image configuration,
// such as the image creation time and history entries.
// File timestamps in the image layers always use a fixed epoch
// so that layer digests are reproducible across builds.
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]
// A URL to a http proxy used to fetch images
DockerOptions []remote.Option
// CompressionLevel is the gzip level (1-9). Zero uses level 5.
CompressionLevel int
// CompressionConcurrency bounds concurrent layer compression per image.
// Zero uses at most two workers, limited by GOMAXPROCS.
CompressionConcurrency int
// PreparationConcurrency bounds metadata/header preparation workers per image.
// Zero uses at most two workers, limited by GOMAXPROCS. All images also
// share a process-wide metadata budget of min(4, startup GOMAXPROCS).
PreparationConcurrency int
// ReadAheadBytes limits prefetched file contents per active layer.
// Zero uses 256 KiB; -1 disables read-ahead for sequential comparisons.
// Tiny (<=64 KiB) and memory-only layers skip read-ahead.
ReadAheadBytes int
// ReadAheadConcurrency bounds distinct source files being prefetched per
// active layer. Zero uses four workers sharing ReadAheadBytes. The number
// of source files and a small byte budget can further reduce worker count.
ReadAheadConcurrency int
// TempDir is the parent directory for compressed blobs; empty uses os.TempDir.
TempDir string
}
type ImageManifest ¶
type ImageManifest struct {
// The Docker Image reference, e.g. "gcr.io/my-project/my-image:sha256:abcdef..."
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 https://go.dev/src/crypto/x509/root_linux.go.
type ImageSpec ¶
type ImageSpec struct {
// The operating system to use for the image.
OS string
// The architecture to use for the image.
Arch string
// 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
// A set of files which should be written to the image.
WriteFiles map[ImagePath][]byte
// 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
}
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 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
}
Click to show internal directories.
Click to hide internal directories.