Documentation
¶
Index ¶
- func DetectAugmentations(dir, primaryStack string) (augs []Augmentation, skipInstall bool, events []DetectionEvent)
- type Augmentation
- type BuildOptions
- type BunStack
- func (s *BunStack) BaseDistro() string
- func (s *BunStack) Detect() bool
- func (s *BunStack) GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
- func (s *BunStack) Init(opts BuildOptions)
- func (s *BunStack) Name() string
- func (s *BunStack) RequiredEnvVars() []EnvVarRequirement
- func (s *BunStack) WebCommand() string
- type DetectionEvent
- type EnvVarRequirement
- type GoStack
- func (s *GoStack) BaseDistro() string
- func (s *GoStack) Detect() bool
- func (s *GoStack) GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
- func (s *GoStack) Init(opts BuildOptions)
- func (s *GoStack) Name() string
- func (s *GoStack) RequiredEnvVars() []EnvVarRequirement
- func (s *GoStack) WebCommand() string
- type MetaStack
- func (s *MetaStack) AddEnv(key, value string)
- func (s *MetaStack) Augmentations() []Augmentation
- func (s *MetaStack) Entrypoint() string
- func (s *MetaStack) Event(kind, name, message string)
- func (s *MetaStack) Events() []DetectionEvent
- func (s *MetaStack) Image() ocispecs.Image
- func (s *MetaStack) Init(opts BuildOptions)
- func (s *MetaStack) RequiredEnvVars() []EnvVarRequirement
- func (s *MetaStack) SetCmd(cmd []string)
- func (s *MetaStack) SetCwd(cwd string)
- func (s *MetaStack) SetEntrypoint(ep []string)
- func (s *MetaStack) SkipJSInstall() bool
- type NodeStack
- func (s *NodeStack) BaseDistro() string
- func (s *NodeStack) Detect() bool
- func (s *NodeStack) GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
- func (s *NodeStack) Init(opts BuildOptions)
- func (s *NodeStack) Name() string
- func (s *NodeStack) RequiredEnvVars() []EnvVarRequirement
- func (s *NodeStack) WebCommand() string
- type PythonStack
- func (s *PythonStack) BaseDistro() string
- func (s *PythonStack) Detect() bool
- func (s *PythonStack) Entrypoint() string
- func (s *PythonStack) GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
- func (s *PythonStack) Init(opts BuildOptions)
- func (s *PythonStack) Name() string
- func (s *PythonStack) RequiredEnvVars() []EnvVarRequirement
- func (s *PythonStack) WebCommand() string
- type RubyStack
- func (s *RubyStack) BaseDistro() string
- func (s *RubyStack) Detect() bool
- func (s *RubyStack) Entrypoint() string
- func (s *RubyStack) Gemfile() ([]byte, []byte, error)
- func (s *RubyStack) GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
- func (s *RubyStack) Init(opts BuildOptions)
- func (s *RubyStack) Name() string
- func (s *RubyStack) RequiredEnvVars() []EnvVarRequirement
- func (s *RubyStack) WebCommand() string
- type RustStack
- func (s *RustStack) BaseDistro() string
- func (s *RustStack) Detect() bool
- func (s *RustStack) GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
- func (s *RustStack) Init(opts BuildOptions)
- func (s *RustStack) Name() string
- func (s *RustStack) RequiredEnvVars() []EnvVarRequirement
- func (s *RustStack) WebCommand() string
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectAugmentations ¶ added in v0.8.0
func DetectAugmentations(dir, primaryStack string) (augs []Augmentation, skipInstall bool, events []DetectionEvent)
DetectAugmentations returns the set of augmentations needed for the app located at dir, given the primary stack that was already selected.
It returns nil (no augmentations) when the primary stack is "node" or "bun", since those stacks already ship npm or bun in their base image. The returned events describe what was detected so they can be surfaced alongside primary stack detection events in the build output.
npm is triggered by the presence of package.json (not just package-lock.json), to preserve compatibility with apps — most notably Rails — that ship a package.json for asset pipelines without committing a lockfile.
skipInstall is true when the app already ships a node_modules directory — in that case the JS tooling (npm/bun) is still installed so onBuild commands can use it, but the package install step is skipped because the user's vendored node_modules will be brought in by copyApp.
Types ¶
type Augmentation ¶ added in v0.8.0
type Augmentation string
Augmentation represents a secondary toolchain layered onto the primary stack's base image. Augmentations are detected from lockfiles in the app directory (e.g. package-lock.json -> npm) and let apps written in one language pull in auxiliary build tooling — most commonly JS package managers used to build frontend assets for a Rails/Django/Go web app.
const ( AugNpm Augmentation = "npm" AugYarn Augmentation = "yarn" AugBun Augmentation = "bun" )
type BuildOptions ¶
type BuildOptions struct {
Log interface{ Info(string, ...any) }
// Name is the name of the application being built
Name string
// Version specifies the language/runtime version to use
// If empty, defaults to latest stable version
Version string
// CacheNS specifies the namespace for persistent cache mounts
CacheNS string
// The alpine image to use for the base image.
AlpineImage string
OnBuild []string
// EnvVars are user-configured environment variables to inject into build steps
// (onBuild commands, asset precompilation). These are set on intermediate LLB
// states only and do not persist to the final image config.
EnvVars map[string]string
}
BuildOptions contains configuration for stack builds
type BunStack ¶
type BunStack struct {
MetaStack
// contains filtered or unexported fields
}
BunStack implements Stack for Bun
func (*BunStack) BaseDistro ¶ added in v0.8.0
func (*BunStack) GenerateLLB ¶
func (*BunStack) Init ¶ added in v0.2.0
func (s *BunStack) Init(opts BuildOptions)
func (*BunStack) RequiredEnvVars ¶ added in v0.8.0
func (s *BunStack) RequiredEnvVars() []EnvVarRequirement
RequiredEnvVars returns the detected environment variable requirements
func (*BunStack) WebCommand ¶ added in v0.2.0
type DetectionEvent ¶ added in v0.2.0
type DetectionEvent struct {
Kind string // e.g., "file", "package", "framework", "config"
Name string // e.g., "Gemfile", "rails", "puma"
Message string // Human-readable description
}
DetectionEvent represents something detected during stack analysis
type EnvVarRequirement ¶ added in v0.8.0
type EnvVarRequirement struct {
Name string // e.g., "DATABASE_URL"
Source string // "gem", "code", "config", "rails_core"
Confidence string // "required", "recommended", "optional"
Reason string // e.g., "pg gem detected in Gemfile"
CanGenerate bool // true if Miren can auto-generate a value (e.g., SECRET_KEY_BASE)
ReadFromFile string // if set, read value from this file path (relative to app dir)
DefaultValue string // if set, this is the default value to use (non-secret)
}
EnvVarRequirement represents a detected environment variable requirement
type GoStack ¶
type GoStack struct {
MetaStack
// contains filtered or unexported fields
}
GoStack implements Stack for Go
func (*GoStack) BaseDistro ¶ added in v0.8.0
func (*GoStack) GenerateLLB ¶
func (*GoStack) Init ¶ added in v0.2.0
func (s *GoStack) Init(opts BuildOptions)
func (*GoStack) RequiredEnvVars ¶ added in v0.8.0
func (s *GoStack) RequiredEnvVars() []EnvVarRequirement
RequiredEnvVars returns the detected environment variable requirements
func (*GoStack) WebCommand ¶ added in v0.2.0
type MetaStack ¶
type MetaStack struct {
// contains filtered or unexported fields
}
MetaStack provides shared functionality for all stack implementations
func (*MetaStack) Augmentations ¶ added in v0.8.0
func (s *MetaStack) Augmentations() []Augmentation
Augmentations returns the secondary tooling layers (npm, bun, ...) attached to this stack by DetectStack.
func (*MetaStack) Entrypoint ¶
func (*MetaStack) Events ¶ added in v0.2.0
func (s *MetaStack) Events() []DetectionEvent
Events returns all detection events
func (*MetaStack) Init ¶ added in v0.2.0
func (s *MetaStack) Init(opts BuildOptions)
func (*MetaStack) RequiredEnvVars ¶ added in v0.8.0
func (s *MetaStack) RequiredEnvVars() []EnvVarRequirement
RequiredEnvVars returns nil by default; stacks can override to provide detected env vars
func (*MetaStack) SetEntrypoint ¶
func (*MetaStack) SkipJSInstall ¶ added in v0.8.0
SkipJSInstall reports whether the app already ships a node_modules directory, in which case the JS package install (npm install / bun install) should be skipped — the tool itself is still installed so onBuild commands can use it.
type NodeStack ¶
type NodeStack struct {
MetaStack
// contains filtered or unexported fields
}
NodeStack implements Stack for Node.js
func (*NodeStack) BaseDistro ¶ added in v0.8.0
func (*NodeStack) GenerateLLB ¶
func (*NodeStack) Init ¶ added in v0.2.0
func (s *NodeStack) Init(opts BuildOptions)
func (*NodeStack) RequiredEnvVars ¶ added in v0.8.0
func (s *NodeStack) RequiredEnvVars() []EnvVarRequirement
RequiredEnvVars returns the detected environment variable requirements
func (*NodeStack) WebCommand ¶ added in v0.2.0
type PythonStack ¶
type PythonStack struct {
MetaStack
// contains filtered or unexported fields
}
PythonStack implements Stack for Python
func (*PythonStack) BaseDistro ¶ added in v0.8.0
func (s *PythonStack) BaseDistro() string
func (*PythonStack) Detect ¶
func (s *PythonStack) Detect() bool
func (*PythonStack) Entrypoint ¶
func (s *PythonStack) Entrypoint() string
func (*PythonStack) GenerateLLB ¶
func (s *PythonStack) GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
func (*PythonStack) Init ¶ added in v0.2.0
func (s *PythonStack) Init(opts BuildOptions)
func (*PythonStack) Name ¶
func (s *PythonStack) Name() string
func (*PythonStack) RequiredEnvVars ¶ added in v0.8.0
func (s *PythonStack) RequiredEnvVars() []EnvVarRequirement
RequiredEnvVars returns the detected environment variable requirements
func (*PythonStack) WebCommand ¶ added in v0.2.0
func (s *PythonStack) WebCommand() string
type RubyStack ¶
type RubyStack struct {
MetaStack
// contains filtered or unexported fields
}
RubyStack implements Stack for Ruby on Rails
func (*RubyStack) BaseDistro ¶ added in v0.8.0
func (*RubyStack) Entrypoint ¶
func (*RubyStack) GenerateLLB ¶
func (*RubyStack) Init ¶ added in v0.2.0
func (s *RubyStack) Init(opts BuildOptions)
func (*RubyStack) RequiredEnvVars ¶ added in v0.8.0
func (s *RubyStack) RequiredEnvVars() []EnvVarRequirement
RequiredEnvVars returns the detected environment variable requirements
func (*RubyStack) WebCommand ¶ added in v0.2.0
type RustStack ¶ added in v0.2.0
type RustStack struct {
MetaStack
// contains filtered or unexported fields
}
RustStack implements Stack for Rust
func (*RustStack) BaseDistro ¶ added in v0.8.0
func (*RustStack) GenerateLLB ¶ added in v0.2.0
func (*RustStack) Init ¶ added in v0.2.0
func (s *RustStack) Init(opts BuildOptions)
func (*RustStack) RequiredEnvVars ¶ added in v0.8.0
func (s *RustStack) RequiredEnvVars() []EnvVarRequirement
RequiredEnvVars returns the detected environment variable requirements
func (*RustStack) WebCommand ¶ added in v0.2.0
type Stack ¶
type Stack interface {
Name() string
// Detect returns true if the given directory contains code for this stack
Detect() bool
// Init is called after detection to perform common initialization
Init(opts BuildOptions)
// GenerateLLB creates the BuildKit LLB for building this stack
GenerateLLB(dir string, opts BuildOptions) (*llb.State, error)
Image() ocispecs.Image
Entrypoint() string
// WebCommand returns the default command for the web service in a Procfile
WebCommand() string
// Events returns detection events collected during Detect() and Init()
Events() []DetectionEvent
// RequiredEnvVars returns environment variables detected as required/recommended
RequiredEnvVars() []EnvVarRequirement
// BaseDistro returns the package manager family of the stack's base image
// ("debian" or "alpine"). Used to dispatch apt vs apk for augmentations.
BaseDistro() string
// contains filtered or unexported methods
}
Stack represents a programming language/framework stack
func DetectStack ¶
func DetectStack(dir string, opts BuildOptions) (Stack, error)
DetectStack identifies the programming stack in the given directory