railpack

Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_* environment variables, railpack.json overlays, build-plan inspection, local CLI installation and usage, and local BuildKit containers. Use for Railpack provider configuration, custom install/build/start commands, Mise or Apt packages, build or runtime variables and secrets, generated-plan debugging, BUILDKIT_HOST errors, or running Railpack from a release or source checkout.

Install
npx skills add 'https://github.com/railwayapp/railpack/tree/main/.'
Incomplete bundle · no download
main · 21a254fScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

core/generate/cache_context.go

core/generate/cache_context.goBrowse 1970 files
View on GitHub
← Back to SKILL.md
package generate import (	"strings" 	"github.com/railwayapp/railpack/core/plan") const (	APT_CACHE_KEY  = "apt"	MISE_CACHE_KEY = "mise") type CacheContext struct {	Caches map[string]*plan.Cache} func NewCacheContext() *CacheContext {	return &CacheContext{		Caches: make(map[string]*plan.Cache),	}} func (c *CacheContext) AddCache(name string, directory string) string {	return c.AddCacheWithType(name, directory, plan.CacheTypeShared)} func (c *CacheContext) AddCacheWithType(name string, directory string, cacheType string) string {	sanitizedName := sanitizeCacheName(name)	c.Caches[sanitizedName] = plan.NewCache(directory)	c.Caches[sanitizedName].Type = cacheType	return sanitizedName} func (c *CacheContext) SetCache(name string, cache *plan.Cache) {	c.Caches[name] = cache} func (c *CacheContext) GetCache(name string) *plan.Cache {	return c.Caches[name]} func (c *CacheContext) GetAptCaches() []string {	if _, ok := c.Caches[APT_CACHE_KEY]; !ok {		aptCache := plan.NewCache("/var/cache/apt")		aptCache.Type = plan.CacheTypeLocked		c.Caches[APT_CACHE_KEY] = aptCache	} 	aptListsKey := "apt-lists"	if _, ok := c.Caches[aptListsKey]; !ok {		aptListsCache := plan.NewCache("/var/lib/apt/lists")		aptListsCache.Type = plan.CacheTypeLocked		c.Caches[aptListsKey] = aptListsCache	} 	return []string{APT_CACHE_KEY, aptListsKey}} func sanitizeCacheName(name string) string {	if len(name) > 0 && name[0] == '/' {		name = name[1:]	}	name = strings.TrimRight(name, "/")	return strings.ReplaceAll(name, "/", "-")}