Introducing a new way to review your PRs.

Read the announcement

solana-foundation / solana-verifiable-build

CLI tool for deterministically building and verifying executable against on-chain programs or buffer accounts

View on GitHub

18 documents · Updated Nov 23, 2026

docs / dockerfile-generation

Dockerfile generation

Dockerfile generation turns upstream Solana and Agave release data into version-specific build environments for verified builds. It keeps each environment tied to the release's Rust toolchain, installer source, and platform-tool behavior so that the Dockerfile catalog can support both historical and current program builds. See Container build environments for the place of this generator in the wider image system.

Generator role

The generator is the bridge between upstream release history and the checked-in Dockerfile catalog. generate_dockerfiles.py discovers release tags, selects the correct release family and build recipe, resolves the required Rust image digest, and writes docker/v<release>.Dockerfile files.

The result is a stable build definition for each supported release. The generator does not choose a single current toolchain for every image. It preserves the toolchain that belongs to each Solana or Agave release.

References: generate_dockerfiles.py• L156-220 generate_dockerfiles.py• L290-382

Release family mapping

The release family determines where the toolchain metadata and installer come from. Older Solana releases need a compatibility path because their original installer cannot be used directly. Newer releases use the Agave release source after the project transition.

Release rangeRelease sourceGenerated environment purpose
Solana before 1.15solana-labs/solanaUse a newer installer script while preserving the requested old Solana version.
Solana 1.15 through before 1.18.24solana-labs/solanaInstall the matching Solana release with a pinned installer.
Solana 1.18.24 and later, plus Agave 2.x–4.0.xanza-xyz/agaveInstall the matching Agave release and prepare its platform tools.
Agave 4.1.x through 4.3.xanza-xyz/agaveInstall a release-train-specific cargo-build-sbf crate and platform tools.

The generator skips tags that are invalid, yanked, or outside the supported historical range. This prevents a bad upstream tag from becoming a catalog entry that cannot support a mainnet build.

References: generate_dockerfiles.py• L148-220

Toolchain resolution

Each generated environment starts from a Rust image selected by the release's declared toolchain. The generator reads the upstream rust-toolchain.toml and can fall back to the release CI Rust version when that file is not available. It then resolves the matching amd64 Rust image digest so the base image remains fixed over time.

This resolution connects two kinds of version data: the release tag selects the Solana or Agave tools, while the release metadata selects the Rust build foundation. A missing Rust version or image digest stops that Dockerfile from being generated rather than producing an incomplete environment.

References: generate_dockerfiles.py• L261-288 generate_dockerfiles.py• L304-328

Installer integrity

Generated installers are checked before they run. The generator fetches the installer content, computes its SHA-256 value, and places that value in the Dockerfile. The image build then fails if the downloaded script does not match the generated pin.

The checksum update path is separate from normal release discovery. It can revisit only the existing versioned Dockerfiles without fetching all upstream release tags. This supports maintenance of installer pins while avoiding accidental creation of new catalog entries.

References: generate_dockerfiles.py• L57-80 generate_dockerfiles.py• L359-369 .github/…/update_existing_dockerfile_checksums.yml• L32-51

Platform-tool preparation

The generated image prepares the Solana build platform tools before a verified program build uses the environment. Most supported Agave releases trigger this setup through a small cargo build. Agave release trains that changed to a crate-based install use an explicit cargo-build-sbf version and may also need a release-train-specific platform-tools argument.

The current crate-install map covers the Agave 4.1.x, 4.2.x, and 4.3.x trains. The release-train map is therefore a compatibility contract. When a new train requires the crate-based path but has no map entry, generation stops instead of silently assigning the wrong platform-tool definition.

References: generate_dockerfiles.py• L36-51 generate_dockerfiles.py• L205-220 generate_dockerfiles.py• L330-352 generate_dockerfiles.py• L398-402

Generation and update flow

The manual GitHub Actions workflow runs the generator and opens a signed pull request for changed Dockerfiles. A normal run checks both upstream release sources. An update run can limit work to Dockerfiles that already exist, which makes checksum maintenance safe for the current catalog.

The following flow shows how release metadata becomes a reviewed catalog change.

flowchart TD
    A[Upstream Solana and Agave release tags] --> B[Select release family and recipe]
    B --> C[Read Rust toolchain metadata]
    C --> D[Resolve amd64 Rust image digest]
    D --> E[Resolve installer checksum]
    E --> F[Write or update versioned Dockerfile]
    F --> G[Create pull request]
    G --> H[Reviewed Dockerfile catalog]

The generator writes a file only when the generated content differs from the existing content. It records changed releases for optional image upload logic, while the GitHub workflow used for catalog updates leaves image publishing to the release workflows described in Dockerfile publishing and releases.

References: generate_dockerfiles.py• L224-259 generate_dockerfiles.py• L371-382 .github/…/generate_dockerfiles.yml• L1-51

Generator modes

The command supports separate concerns for catalog creation, catalog refresh, and optional image upload.

ModeMain effectUse
DefaultDiscover both upstream tag sets and add new Dockerfiles.Extend the catalog for new releases.
--update_existingPermit replacement of existing Dockerfiles.Refresh definitions when toolchain or installer data changes.
--only_existing with --update_existingProcess only checked-in docker/v*.Dockerfile files.Refresh existing entries without network discovery of all releases.
--skip_cacheDo not query the existing published image tag set.Run generation without image-cache checks.
--uploadBuild and push generated images that need publishing.Use the script's optional local publishing path.
--versionLimit optional upload work to one release or release line.Rebuild a selected image.

The normal repository workflow uses the default mode. The checksum workflow combines --update_existing, --only_existing, and --skip_cache so that its scope stays limited to existing files.

References: generate_dockerfiles.py• L11-21 generate_dockerfiles.py• L388-464 .github/…/generate_dockerfiles.yml• L28-45 .github/…/update_existing_dockerfile_checksums.yml• L28-45

Change checklist

When these files or sections are changed, remember to consider these:

  • Update the release-family rules and installer source together when an upstream project changes its release boundary.
  • Add a release-train entry before generating a train that requires a crate-based cargo-build-sbf install.
  • Keep the Rust toolchain lookup, amd64 image digest map, and generated FROM reference aligned.
  • Preserve the checksum injection path for every template that downloads an installer.
  • Keep the existing-file flags aligned with the checksum workflow so maintenance does not create unplanned Dockerfiles.
  • Keep generated version names aligned with the docker/v<version>.Dockerfile paths consumed by the publishing workflows.

Important failure modes

TriggerConsequenceGuard
An upstream release has no usable Rust toolchain metadata or Rust image digest.Its Dockerfile is skipped and the catalog has no environment for that release.The generator requires a resolved Rust version and amd64 image digest before writing the file.
An installer changes after generation.The Docker image build stops at the checksum test instead of running unverified installer content.Refresh existing checksum pins through the dedicated update workflow.
A new Agave train lacks a cargo-install map entry.Generation raises an error rather than choosing an unknown crate or platform-tool version.Add the train's crate pin and tool arguments to the map before generation.
A tag is yanked, malformed, or outside the supported range.The tag does not produce a Dockerfile.The release filter skips invalid and known unsupported tags.

Key files

FileWhy to read it
generate_dockerfiles.pyDefines release selection, toolchain resolution, integrity pins, update modes, and optional image upload behavior.
.github/…/generate_dockerfiles.ymlShows how the repository runs generation and turns changes into a signed pull request.
.github/…/update_existing_dockerfile_checksums.ymlShows the narrow maintenance flow for refreshing installer checksum pins.
docker/v1.14.1.DockerfileIllustrates the compatibility environment for an old Solana release.
docker/v2.3.0.DockerfileIllustrates a checksum-pinned Agave installer environment with platform-tool preparation.
docker/v4.1.2.DockerfileIllustrates the release-train-specific cargo install path.
Container build environmentsPlaces generation in the wider image system.
Versioned Dockerfile catalogExplains how generated files serve as the supported environment catalog.
Image build and installationExplains how the generated environments support image build and installation flows.
Dockerfile publishing and releasesExplains how generated files become published images.