Documentation
¶
Index ¶
- func GetBuildArgsAndTarget(parsedConfig *config.SubstitutedConfig, ...) (map[string]string, string)
- func GetImageName(localWorkspaceFolder, prebuildHash string) string
- func RewriteDockerfile(dockerfileContent string, extendedBuildInfo *feature.ExtendedBuildInfo) (string, error)
- type BuildOptions
- type NewOptionsParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBuildArgsAndTarget ¶
func GetBuildArgsAndTarget( parsedConfig *config.SubstitutedConfig, extendedBuildInfo *feature.ExtendedBuildInfo, ) (map[string]string, string)
func GetImageName ¶
func RewriteDockerfile ¶
func RewriteDockerfile( dockerfileContent string, extendedBuildInfo *feature.ExtendedBuildInfo, ) (string, error)
Types ¶
type BuildOptions ¶
type BuildOptions struct {
// BuildArgs are build-time variables passed to the Dockerfile (e.g., VERSION=1.0).
BuildArgs map[string]string
// Labels are metadata key-value pairs to attach to the built image.
Labels map[string]string
// CliOpts are additional command-line options to pass to the build command.
CliOpts []string
// Images are the image names/tags to apply to the built image (e.g., myapp:latest).
Images []string
// CacheFrom specifies images to use as cache sources for layer reuse.
CacheFrom []string
// CacheTo specifies where to export the build cache (e.g., type=registry,ref=...).
CacheTo []string
// Dockerfile is the path to the Dockerfile to build. May be a rewritten Dockerfile with features.
Dockerfile string
// Context is the build context path (directory containing files needed for the build).
Context string
// Contexts are additional named build contexts (e.g., for COPY --from=name).
Contexts map[string]string
// Target specifies the target build stage in a multi-stage Dockerfile.
Target string
// Load controls whether to load the built image into the local Docker daemon.
// When true, uses BuildKit's "moby" exporter which creates a tar and imports it.
Load bool
// Push controls whether to push the built image directly to a registry during build.
// When true, uses BuildKit's "image" exporter which streams directly to the registry.
// Mutually exclusive with Load.
Push bool
// Upload controls whether to upload the build context. Used for remote builds.
Upload bool
}
BuildOptions contains all configuration for building a dev container image.
func NewOptions ¶
func NewOptions(params NewOptionsParams) (*BuildOptions, error)
NewOptions creates BuildOptions from the provided parameters, configuring the build based on the devcontainer.json, features, and CLI options.
type NewOptionsParams ¶ added in v0.10.0
type NewOptionsParams struct {
// DockerfilePath is the path to the original Dockerfile.
DockerfilePath string
// DockerfileContent is the content of the Dockerfile, potentially modified with features.
DockerfileContent string
// ParsedConfig is the parsed and substituted devcontainer.json configuration.
ParsedConfig *config.SubstitutedConfig
// ExtendedBuildInfo contains additional build information including features and metadata.
ExtendedBuildInfo *feature.ExtendedBuildInfo
// ImageName is the name to tag the built image with.
ImageName string
// Options contains provider-specific build options from the CLI.
Options provider.BuildOptions
// PrebuildHash is the hash used for prebuild image tagging.
PrebuildHash string
}
NewOptionsParams contains the parameters needed to create BuildOptions.
Click to show internal directories.
Click to hide internal directories.