Introducing a new way to review your PRs.

Read the announcement

frappe / frappe_docker

Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development

View on GitHub

15 documents · Updated Nov 23, 2026

docs / image-build-and-publish-automation

Image build and publish automation

The image automation turns Frappe and ERPNext source versions into tested container images. GitHub Actions resolve source tags, build core images for both supported CPU types, check image size and runtime behavior, and publish approved artifacts to Docker Hub and GHCR. A separate reusable flow builds an app image on top of an existing Frappe image. This page is a child of Container image builds; Image variant definitions explains the roles of the images that these workflows build. See Repository quality automation for the wider check system.

Workflow entry points

The workflow set has separate paths for development, stable releases, Bench images, and app images. Pull requests use the build and test paths without public publication. Scheduled, manual, push, and repository-release events use the same reusable jobs when their conditions allow publication.

PathMain purposePublication condition
DevelopmentBuild and test the develop image setPublishes only from the canonical repository and not from a pull request
StableBuild and test version 15 and version 16 image setsPublishes only from the canonical repository and not from a pull request
BenchBuild and test the Bench imagePublishes only from the canonical repository and not from a pull request
AppAdd one app to an existing Frappe imageControlled by the caller's push input
Legacy dispatchPreserve manual entry points for development and stable buildsDelegates to the matching core workflow

The stable path also updates the example deployment versions and starts the Helm release flow after the version 16 images publish. It checks the Helm release tool before it starts the release. These are downstream release effects rather than part of the image test itself. References: .github/…/core-build-develop.yml• L9-67, .github/…/core-build-stable.yml• L9-212, .github/…/core-build-bench.yml• L3-75, .github/…/build_develop.yml• L3-21, .github/…/build_stable.yml• L3-21, .github/…/app-build-image.yml• L3-74

Core image lifecycle

The core image lifecycle resolves a source version before it builds anything. The reusable test workflow builds each architecture into a temporary registry, checks size growth against a trusted main-run baseline when one exists, scans the resulting images, and runs the repository's integration checks. A successful test job passes the resolved Frappe and ERPNext tags to the publish workflow.

This diagram shows the shared lifecycle used by both development and stable image builds.

flowchart LR
    E[Workflow event] --> V[Resolve source tags and baseline]
    V --> B[Build amd64 and arm64 images]
    B --> Z[Check image size growth]
    Z --> S[Scan built images]
    S --> T[Run integration checks]
    T --> P{Publish allowed?}
    P -- No --> R[Report build and test result]
    P -- Yes --> H[Publish multi-architecture images]
    H --> G[Publish base images to GHCR]

The version resolver treats develop as a moving development tag. For a stable major version it selects the newest matching Frappe tag and, when the selected repository is ERPNext, the newest matching ERPNext tag. Pull requests can reuse versions from a successful main-run baseline. The resolved values are workflow outputs so the publish stage uses the same versions that passed the test stage.

References: .github/…/core-build-test-images.yml• L3-38 .github/…/core-build-test-images.yml• L45-63 .github/…/image_sizes.py• L61-165 .github/…/get_latest_tags.py• L15-40 .github/…/get_latest_tags.py• L63-83

Core build and test stage

The build and test stage checks the image set as a runnable system rather than as a successful image compilation. It builds one image per architecture in a local registry, checks compressed image-layer growth against a retained successful main run, scans the base, build, and ERPNext images when present, and starts the test environment to check service links, HTTP endpoints, assets, file access, backups, HTTPS, ERPNext behavior, and database compatibility.

The scan produces SARIF reports for later review and adds a finding summary to pull requests. Scan steps do not block the image checks. On main pushes for version 16 amd64 builds, the build-image report also goes to GitHub code scanning. Image-size failures and the integration suite can block the test job, so the publish stage cannot run until the required checks complete.

References: .github/…/core-build-test-images.yml• L65-133 .github/…/core-build-test-images.yml• L134-253 .github/…/core-build-test-images.yml• L255-278 .github/…/image_sizes.py• L228-345 docker-bake.hcl• L58-117 tests/conftest.py• L41-124 tests/test_frappe_docker.py• L10-175

Core pull request reporting

The pull request report turns a completed stable image build into one GitHub comment. It links each version and architecture to its build status, build time, and compressed sizes against a trusted prior run. The reporter finds the matching pull request from the source repository, branch, and commit so fork builds receive the result on the correct pull request.

The report workflow runs after the stable workflow completes. It reads the build jobs and image-size artifacts, then updates the existing bot comment instead of creating a new comment for every run.

References: .github/…/core-report-pr-build.yml• L3-31 .github/…/report_pr_build.py• L132-177 .github/…/report_pr_build.py• L206-287

Core publish stage

The publish stage rebuilds the approved image set as a multi-architecture artifact. It logs in to Docker Hub and publishes the normal image targets. It then publishes the reusable base and build targets to GHCR under the repository owner namespace.

The image tags preserve the source version and add useful aliases. Development builds also receive latest. Versioned releases receive short major-version aliases when the source tag has the expected form. The published images include software bill of materials and provenance attestations.

References: .github/…/core-publish-images.yml• L42-112 docker-bake.hcl• L69-80 docker-bake.hcl• L95-117

Stable release follow-up

The stable workflow treats version 16 image publication as the gate for release metadata. After publication succeeds, it resolves the current tags again, updates example.env and pwd.yml, and pushes those changes only when their values changed. It also checks that the Helm release tool can start before the release job runs. The release job then invokes the Helm release tool for the same major version.

The follow-up keeps example deployments and the Helm chart release aligned with the image versions that the stable flow has just published.

References: .github/…/core-build-stable.yml• L112-212 .github/…/get_latest_tags.py• L15-40 .github/…/update_example_env.py• L5-24 .github/…/update_pwd.py• L5-26

App image lifecycle

The app image workflow packages one app with an existing Frappe base and build image. The caller supplies the app repository and ref, the Frappe image ref, the final image name and tag, and whether to push. The workflow normalizes that source into an app list, builds a local smoke-test image, checks that both Frappe and the named app are present, and only then creates the requested final image.

This diagram shows the app-specific path from source selection to an optional registry push.

flowchart LR
    I[App and Frappe inputs] --> J[Create app source list]
    J --> S[Build local smoke-test image]
    S --> C[Check Frappe and app content]
    C --> D{Push requested?}
    D -- No --> N[Finish after smoke test]
    D -- Yes --> A[Build and push final image]

The workflow can publish to GHCR or another registry. It uses a separate concurrency group per app and source ref so a newer run can replace an older run for the same app build. The final build can target the caller's platform set, while the smoke test runs on linux/amd64.

References: .github/…/app-build-image.yml• L3-85 .github/…/app-build-image.yml• L87-156 .github/…/app-build-image.yml• L157-189

Image roles and artifacts

The build definition gives the automation three core image roles. The base image provides the common runtime, the build image adds build tools, and the erpnext image contains the assembled application. The default group builds the application and both supporting images. The base-images group limits publication to the two reusable supporting images.

Artifact groupRole in the image systemMain publication use
baseShared runtime foundation for application containersDocker Hub and GHCR
buildBuild environment used by later image assemblyDocker Hub and GHCR
erpnextStable application image assembled from Frappe and ERPNextDocker Hub
benchDevelopment and command-line imageSeparate Bench workflow
App imageFrappe image extended with one appCaller-selected registry

The Bench workflow is separate from the core application lifecycle. It builds and tests the Bench image on pull requests and schedules, then publishes it only for non-pull-request events from the canonical repository.

References: docker-bake.hcl• L39-67 docker-bake.hcl• L95-117 .github/…/core-build-bench.yml• L1-75 images/…/Dockerfile• L1-170

Workflow quality checks

The lint workflow gives the image automation a separate code-quality gate. It runs unit checks for the workflow scripts and then applies the repository's pre-commit checks to all files on pushes and pull requests to main. This protects the scripts and workflow files that coordinate image builds without changing the image publication path.

References: .github/…/lint.yml• L3-38

Change checklist

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

  • Keep the inputs and outputs of core-build-test-images.yml aligned with the callers and with the publish workflow. A changed tag or version input can make the published image differ from the tested image.
  • Keep the docker-bake.hcl target names and registry tag rules aligned with the workflow target selections. The GHCR step depends on the base-images group.
  • Keep the architecture matrix in the test path aligned with the multi-architecture platform override in the publish path.
  • When changing image size checks, preserve the link between retained successful main-run artifacts, architecture names, report identity, and the image-size policy.
  • When changing the image scan steps, preserve the SARIF artifact and pull request summary conditions so findings remain visible without changing the test gate by accident.
  • When changing stable version resolution, check both the generated example.env value and the pwd.yml image reference. They are updated only after version 16 publication.
  • When changing the stable release gate, keep the Helm tool check and the release job dependent on the successful version 16 publication.
  • When changing pull request reporting, keep the stable workflow path, run event, artifact names, and report identity checks aligned. A mismatch can leave a pull request without a report or show data from another run.
  • When changing app image inputs, preserve the contract between the caller's app ref, the generated app source list, the smoke-test image, and the final image tag.
  • When changing Bench image triggers or targets, keep its daily and pull request checks separate from the core image publish path.
  • When changing workflow scripts or shared action setup, keep the unit checks and pre-commit path able to run on both pushes and pull requests.

Important failure modes

TriggerConsequenceGuard
A stable source version has no matching upstream tagVersion resolution fails before image buildThe resolver rejects an empty tag set and requires a supported major version
A retained baseline has the wrong image type, release line, architecture, or input identityThe size check cannot compare the current image safelyThe size tool validates report identity before comparison
Image growth exceeds both configured limitsThe test job fails and publication does not runThe size check compares current layers with a trusted successful main-run baseline
A core architecture build, image-size check, or integration check failsThe publish job does not runPublication depends on the completed test job
A run comes from a pull request or a non-canonical repositoryImages are built or tested without public publicationPublish jobs require the canonical repository and exclude pull requests
Docker Hub, GHCR, or the selected app registry credentials are missing or invalidThe image artifact cannot be pushedEach registry login occurs immediately before its publish step
A stable pull request report cannot match the source repository, branch, and commitThe completed build has no updated pull request commentThe reporter requires one exact open pull request match
A stable report artifact is expired, malformed, or from another runSize and build-time cells are omitted from the commentThe reporter checks artifact validity, report identity, and source run identity
The app source list does not install both required appsThe app workflow stops before the final pushThe smoke test checks for both the Frappe and named app directories
Stable version metadata changes after publication but cannot be pushedexample.env and pwd.yml can lag behind the published imagesThe follow-up compares the generated files and uses repository write permission
The Helm release tool check fails or the release job lacks its deploy keyThe stable image publish can succeed without a Helm chart releaseThe release waits for the tool check and uses the configured Helm deploy key
Workflow script tests or pre-commit checks failThe quality workflow reports failure even when image builds are validThe lint workflow runs both checks on every main push and pull request

Key files

FileWhy to read it
.github/…/core-build-develop.ymlShows the development entry point and its test-then-publish handoff
.github/…/core-build-stable.ymlShows stable version coverage, metadata updates, and the Helm release follow-up
.github/…/core-build-test-images.ymlDefines source resolution, architecture builds, image-size checks, image scans, and integration gating
.github/…/core-report-pr-build.ymlShows how completed stable pull request builds reach pull request comments
.github/…/report_pr_build.pyDefines the build status, baseline, timing, and image-size report shown on pull requests
.github/…/core-publish-images.ymlDefines registry publication and artifact attestations for core images
.github/…/app-build-image.ymlDefines the reusable app image smoke-test and push flow
.github/…/image_sizes.pyDefines trusted baselines, image-size reports, and growth limits
docker-bake.hclDefines the image roles, target groups, source inputs, and tag aliases used by the workflows
.github/…/get_latest_tags.pyDefines how development and stable source tags are selected
.github/…/lint.ymlShows the quality checks applied to workflow and helper-script changes
tests/test_frappe_docker.pyShows the system behavior that the core image test stage protects