Documentation
¶
Index ¶
- func BuildImage(ctx context.Context, spec *ImageSpec, cfg ImageBuildConfig) (v1.Image, error)
- 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 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 ¶
func BuildImage ¶
BuildImage builds a docker image from the given spec.
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 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]
// A URL to a http proxy used to fetch images
DockerOptions []remote.Option
}
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.