This is a fork of railwayapp/railpack, maintained to carry the Flightcontrol-specific frontend behavior described below.
buildkit/frontend.go never populated CacheImports on its own internal
client.SolveRequest calls, so
docker buildx build --cache-from / --cache-to never reached the vertices
railpack-frontend defines. Export worked (that's driven by the outer solve,
not the frontend), but import never produced a single cache hit, even across
consecutive builds of an unchanged repo.
See buildkit/frontend.go's parseCacheImports/parseCacheFromRefs for the
fix. It merges two sources, in order of reliability:
- A
cache-frombuild-arg (--build-arg cache-from=<ref>[,<ref>...]) - the mechanism our own CI pipeline uses, since it already controlscache-key/secrets-hash/github-tokenthe same way and doesn't depend on unverified BuildKit-internal opt forwarding. - The
cache-from/cache-importsFrontendOpt keys the standard Dockerfile frontend reads (github.com/moby/buildkit/frontend/dockerui), as a best-effort bonus in case BuildKit does forward these to externalgateway.v0frontends in some invocation paths - kept for correctness with upstream behavior, not required for our own use.
The frontend accepts an export-path build argument containing an absolute
path in the final deploy filesystem. When set, the frontend returns a scratch
state containing only that directory. Flightcontrol static builds combine this
with BuildKit's local exporter to avoid serializing and loading the full
runtime image solely to copy static assets back out.
docker buildx build \
--build-arg export-path=/app/dist \
--output type=local,dest=extracted-static \
-f railpack-plan.json .mainmirrorsrailwayapp/railpack:mainuntouched, for easy diffing/merging against upstream.flightcontrol/v<version>branches carry Flightcontrol's patches rebased onto each upstream release tag we actually run in production (older branches may retain a patch-specific suffix). The image we publish is always built from one of these branches, never frommain.
git fetch origin
git checkout -b flightcontrol/v<new-version> v<new-version>
git cherry-pick <flightcontrol-patch-commits>
docker build --platform linux/amd64 -f images/alpine/frontend/Dockerfile -t <registry>/railpack-frontend:v<new-version>-fc<N> .
docker push <registry>/railpack-frontend:v<new-version>-fc<N>Then update the immutable frontend tag and its matching feature gate in
packages/tower-go/pkg/steps/ci/build_helpers/railpack_instructions.go in the
Flightcontrol monorepo.