Documentation
¶
Overview ¶
Package plan converts a detected Framework into an abstract BuildPlan. It selects base images, build stages, hardening steps (non-root user, tini, health checks, distroless), and BuildKit cache mounts based on the runtime. Plans are pure data — no I/O, no side effects.
Index ¶
- func ApplySecretMounts(plan *core.BuildPlan, dir string) []detect.SecretDef
- func BuildkitCacheArgs(appID string) []string
- func CacheDir(appID string) string
- func FrameworkDefaults(name string) (buildCmd, startCmd string)
- func Plan(fw *core.Framework, opts ...PlanOption) (*core.BuildPlan, error)
- func ResolveDockerTag(runtime, version string) string
- func SanitizeAppID(appID string) string
- func SecretBuildHint(secrets []detect.SecretDef) string
- func SecretIgnoreFiles() []string
- type PlanConfig
- type PlanOption
- func WithBaseImage(image string) PlanOption
- func WithBuildCacheDisabled() PlanOption
- func WithBuildCommand(cmd string) PlanOption
- func WithContextRoot(appSubdir string) PlanOption
- func WithEntrypoint(args ...string) PlanOption
- func WithExpose(port int) PlanOption
- func WithExtraEnv(env map[string]string) PlanOption
- func WithHealthcheck(cmd string) PlanOption
- func WithHealthcheckDisabled() PlanOption
- func WithInstallCommand(cmd string) PlanOption
- func WithRuntimeImage(image string) PlanOption
- func WithSecrets(secrets []core.SecretMount) PlanOption
- func WithStartCommand(cmd string) PlanOption
- func WithSystemDeps(deps ...string) PlanOption
- func WithUser(user string) PlanOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplySecretMounts ¶
ApplySecretMounts detects private registry usage in dir and wires BuildKit secret mounts into the appropriate install step of the plan. Returns the list of secrets applied (empty if none detected).
func BuildkitCacheArgs ¶
BuildkitCacheArgs returns --cache-from and --cache-to flags for buildctl/docker buildx.
func CacheDir ¶
CacheDir returns the BuildKit cache directory for an app. The appID is sanitized to prevent path traversal.
func FrameworkDefaults ¶
FrameworkDefaults returns sensible build and start commands for a framework. Returns empty strings for unknown frameworks.
func Plan ¶
Plan converts a detected Framework into a BuildPlan. Options are applied after the plan is built, overriding defaults.
func ResolveDockerTag ¶
func SanitizeAppID ¶
SanitizeAppID makes an app ID safe for use in file paths.
func SecretBuildHint ¶
SecretBuildHint returns a Dockerfile comment documenting the docker build invocation needed to supply secrets. Returns "" when no secrets are present.
func SecretIgnoreFiles ¶
func SecretIgnoreFiles() []string
SecretIgnoreFiles returns file patterns that should be added to .dockerignore when secrets are detected, preventing credential files from leaking into the build context.
Types ¶
type PlanConfig ¶
type PlanConfig struct {
User *string
Healthcheck *string
RuntimeImage *string
BaseImage *string
Entrypoint []string
ExtraEnv map[string]string
Expose *int
InstallCmd *string
BuildCmd *string
StartCmd *string
SystemDeps []string
NoBuildCache bool
Secrets []core.SecretMount
ContextRoot *string
}
PlanConfig holds user-specified overrides for Plan(). A nil pointer means "not set — use default". A non-nil pointer (even &"") means "explicitly set — use this value, possibly disabling the feature".
func ResolvePlanConfig ¶
func ResolvePlanConfig(opts []PlanOption) *PlanConfig
ResolvePlanConfig resolves a slice of PlanOption into a PlanConfig.
type PlanOption ¶
type PlanOption interface {
// contains filtered or unexported methods
}
PlanOption modifies a planConfig.
func WithBaseImage ¶
func WithBaseImage(image string) PlanOption
func WithBuildCacheDisabled ¶
func WithBuildCacheDisabled() PlanOption
func WithBuildCommand ¶
func WithBuildCommand(cmd string) PlanOption
WithBuildCommand overrides the build step command. This is a no-op for single-stage plans that have no explicit "build" stage.
func WithContextRoot ¶
func WithContextRoot(appSubdir string) PlanOption
func WithEntrypoint ¶
func WithEntrypoint(args ...string) PlanOption
func WithExpose ¶
func WithExpose(port int) PlanOption
func WithExtraEnv ¶
func WithExtraEnv(env map[string]string) PlanOption
func WithHealthcheck ¶
func WithHealthcheck(cmd string) PlanOption
func WithHealthcheckDisabled ¶
func WithHealthcheckDisabled() PlanOption
func WithInstallCommand ¶
func WithInstallCommand(cmd string) PlanOption
func WithRuntimeImage ¶
func WithRuntimeImage(image string) PlanOption
func WithSecrets ¶
func WithSecrets(secrets []core.SecretMount) PlanOption
func WithStartCommand ¶
func WithStartCommand(cmd string) PlanOption
func WithSystemDeps ¶
func WithSystemDeps(deps ...string) PlanOption
func WithUser ¶
func WithUser(user string) PlanOption