Documentation
¶
Overview ¶
converts a railpack build plan to a BuildKit LLB state and image config
for platforms: used by `ghcr.io/railwayapp/railpack-frontend` to accept railpack plans via BuildKit
Index ¶
- Constants
- func Build(ctx context.Context, c client.Client) (*client.Result, error)
- func BuildWithBuildkitClient(appDir string, plan *plan.BuildPlan, opts BuildWithBuildkitClientOptions) error
- func ParsePlatformWithDefaults(platformStr string) (specs.Platform, error)
- func StartFrontend()
- type BuildWithBuildkitClientOptions
- type ConvertPlanOptions
- type Image
Constants ¶
const (
WorkingDir = "/app"
)
Variables ¶
This section is empty.
Functions ¶
func BuildWithBuildkitClient ¶
func BuildWithBuildkitClient(appDir string, plan *plan.BuildPlan, opts BuildWithBuildkitClientOptions) error
func ParsePlatformWithDefaults ¶ added in v0.9.0
ParsePlatformWithDefaults parses a platform string and returns the corresponding specs.Platform. If the input is empty, it defaults to a Linux platform that matches the host architecture.
This function handles the common case where we need to map host platforms to container platforms. We cannot use platforms.DefaultSpec() directly because it returns the host platform (e.g., darwin/arm64/v8 on macOS), but container base images only support Linux platforms. Instead, we map the host architecture to the corresponding Linux container platform to provide optimal performance while ensuring compatibility with container runtimes.
Examples:
- "" -> linux/amd64 (on Intel hosts) or linux/arm64/v8 (on ARM hosts)
- "linux/amd64" -> linux/amd64
- "linux/arm64" -> linux/arm64
- "linux/arm64/v8" -> linux/arm64/v8
func StartFrontend ¶
func StartFrontend()
Types ¶
type ConvertPlanOptions ¶
type ConvertPlanOptions struct {
BuildPlatform specs.Platform
// Hash of all the secrets values that can be used to invalidate the layer cache when a secret changes
SecretsHash string
// Unique value prepended to all cache mount keys
CacheKey string
// BuildKit session ID
SessionID string
// Token used to make authenticated API requests to GitHub to increase rate limits
GitHubToken string
}
type Image ¶
type Image struct {
specs.Image
// Config defines the execution parameters which should be used as a base when running a container using the image.
Config specs.ImageConfig `json:"config,omitempty"`
// Variant defines platform variant. To be added to OCI.
Variant string `json:"variant,omitempty"`
}
Image is the JSON structure which describes some basic information about the image. This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON.