Container image builds
This repository defines four image construction paths for Frappe-based systems. Bench supports development work. Production creates the standard core image family. Layered and custom paths add selected applications while sharing or controlling the core runtime. A shared build configuration keeps these paths aligned with their versioned artifacts.
Image construction paths
The image paths serve different points in the development and deployment lifecycle. Choose a path based on whether you need a development tool image, the standard Frappe and ERPNext image, published shared layers, or direct control of the build inputs.
| Path | Main result | Best fit |
|---|---|---|
| Bench | A development environment with the Bench command-line tool | Local development, debugging, and Bench work |
| Production | A core image family for Frappe and ERPNext | Standard core releases and quick starts |
| Layered | An app image built on published base and build images | Fast builds with selected extra apps |
| Custom | An app image built from a plain Python base | Controlled builds with selected apps and tool versions |
The detailed variant rules are in Image variant definitions. The CI handoff between core images and downstream app images is in Image build and publish automation.
Bench image
The Bench image provides the tools and supporting packages needed to create and work with a Frappe bench. It is a development environment rather than the normal application runtime image. Its build also checks that the main development commands work in an interactive shell. The image supports current and previous Python and Node release lines so development work can cover more than one supported runtime. (images/bench/Dockerfile)
The image supports both amd64 and arm64 publication. The scheduled Bench workflow builds and tests it before it publishes the image outside pull requests. (.github/workflows/core-build-bench.yml)
References: images/…/Dockerfile• L1-12 images/…/Dockerfile• L104-132 images/…/Dockerfile• L141-178 .github/…/core-build-bench.yml• L18-59
Production image family
The production path creates three related artifacts from one build definition. base supplies the shared runtime. build adds tools needed to build applications. erpnext carries the built Frappe and ERPNext bench for normal use. This split lets later image paths reuse common layers without rebuilding the full core image. (images/production/Containerfile)
The production path installs Frappe and ERPNext from selected repositories and branches. It is the standard core release path rather than the flexible path for arbitrary applications. Its shared runtime includes the services and tools needed by the application image, including web serving, database clients, browser support, and asset generation. (images/production/Containerfile)
References: images/…/Containerfile• L1-15 images/…/Containerfile• L95-150 images/…/Containerfile• L150-181
Layered application image
The layered path adds an application to already published base and build images. The application set comes from an apps.json input, so a downstream project can build its image without rebuilding the shared runtime and build layers. (images/layered/Containerfile)
This path is the standard downstream route when the required Frappe and build versions already exist in a registry. The final image follows the same bench, site, log, entrypoint, and asset behavior as the production application image. (images/layered/Containerfile)
References: images/…/Containerfile• L1-32 images/…/Containerfile• L34-63
Custom application image
The custom path builds the common runtime and application content in one definition. It accepts an optional app list and gives the builder direct control over the Python and Node versions used for the image. The image also enables package tools needed by applications that use more than one JavaScript package workflow. (images/custom/Containerfile)
This path is useful when a project needs a fixed app set but cannot rely on a matching published base and build pair. Its final application stage follows the same runtime contract as the layered and production paths. (images/custom/Containerfile)
References: images/…/Containerfile• L1-21 images/…/Containerfile• L102-161 images/…/Containerfile• L161-190
Build artifact coordination
The Buildx Bake file is the central map for the core artifacts. It supplies common repository and version inputs, selects each build definition, and assigns tags that other builds can use.
Core target graph
The default group builds the complete core family. The base-images group builds only the shared base and build artifacts. That is the set needed by downstream layered images and is also published to GHCR.
The diagram shows how one versioned core build produces both a ready application image and reusable inputs for later app builds.
flowchart LR
V[Repository and version inputs] --> B[docker-bake.hcl]
B --> Bench[bench]
B --> Base[base]
B --> Build[build]
B --> ERP[erpnext]
Base --> Layered[layered app image]
Build --> Layered
Apps[apps.json] --> Layered
The Bake targets use images/bench/Dockerfile for Bench and images/production/Containerfile for the core family. The layered and custom paths remain separate entry points because they have different source-image and app-selection needs. (docker-bake.hcl)
References: docker-bake.hcl• L39-67 docker-bake.hcl• L83-117 images/…/Containerfile• L1-4 images/…/Containerfile• L1-5
Version and tag inputs
The build configuration passes the selected Frappe and ERPNext repositories and refs into the core image family. It also passes the Python and Node versions that define the language runtime for that build. The registry prefix controls where the resulting tags point. (docker-bake.hcl)
Tags preserve the selected release or development line and add useful aliases for development and major releases. Downstream builds must use a frappe_ref that names the same shared base and build version family. (docker-bake.hcl, .github/workflows/app-build-image.yml)
References: docker-bake.hcl• L4-37 docker-bake.hcl• L69-92 docker-bake.hcl• L95-117 .github/…/app-build-image.yml• L18-34
Core and app handoff
Core image automation first resolves source versions and builds the core artifacts in a local registry. It tests those artifacts before publication. Publication sends the application image and shared images to their registries. A downstream app workflow then consumes the published base and build pair, installs its app, and optionally pushes a final image.
The two stages form one artifact contract: core automation provides versioned shared inputs, while app automation adds project-specific content.
The diagram shows how core publication supplies the shared images that a downstream app build needs.
sequenceDiagram
participant Core as Core pipeline
participant Registry as Image registry
participant App as App pipeline
Core->>Core: Resolve versions
Core->>Core: Build and test core images
Core->>Registry: Publish erpnext, base, and build
App->>Registry: Read matching base and build
App->>App: Add selected app
App->>Registry: Publish final app image when enabled
The reusable core workflows separate testing from publication. The reusable app workflow creates the app list from the requested repository and ref, then builds the layered path for the requested platform set. (.github/workflows/core-build-test-images.yml, .github/workflows/core-publish-images.yml, .github/workflows/app-build-image.yml)
References: .github/…/core-build-test-images.yml• L33-108 .github/…/core-publish-images.yml• L36-92 .github/…/app-build-image.yml• L104-189
Related pages
The image paths and their runtime differences are described in Image variant definitions. The triggers, version resolution, registry handoff, and downstream app flow are described in Image build and publish automation.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the
baseandbuildtag contract aligned betweendocker-bake.hcl, core publication, and thefrappe_refconsumed by layered app builds. - Keep image path changes aligned with the workflow path filters. A changed Containerfile can otherwise avoid the intended CI pipeline.
- If the app-list format or app ref rules change, update both the app workflow that creates apps.json and the layered and custom build paths that consume it.
- If a runtime or build version changes, update the core workflow inputs and the downstream version values that select shared images.
- If platform support changes, review architecture setup, image publication platforms, and architecture-specific package sources together.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
A layered build uses a frappe_ref for which base or build was not published | The app image cannot resolve its shared source images | Publish the matching core family before starting the downstream app build |
| apps.json names a repository or ref that does not contain the requested app directory | The smoke check fails or the final image lacks the expected app | Keep app_name, app_repo, and app_ref as one tested input set |
| Core image tests pass but publication is skipped for a non-release context | Local CI images exist only for that run and cannot serve later app builds | Treat pull request builds as validation only and use a publish-capable run for shared artifacts |
| A target is built for an unsupported architecture or package source | The image build fails during an architecture-specific dependency step | Keep QEMU, platform lists, and architecture-aware package versions in sync |
| A custom or layered build receives no valid app list | The image contains the framework base but not the intended extra application | Validate the generated app-list input before relying on the final image |
Key files
| File | Why to read it |
|---|---|
docker-bake.hcl | Defines the core target graph, shared inputs, registry prefix, and tag rules |
images/bench/Dockerfile | Shows the development-oriented Bench image path and its test target |
images/production/Containerfile | Shows how the reusable core artifacts and the standard ERPNext image relate |
images/layered/Containerfile | Shows the downstream path that combines published shared images with selected apps |
images/custom/Containerfile | Shows the self-contained path for controlled runtime and app builds |
| .github/…/core-build-test-images.yml | Connects version resolution, multi-architecture builds, and image tests |
| .github/…/core-publish-images.yml | Connects tested core artifacts to Docker Hub and GHCR publication |
| .github/…/app-build-image.yml | Connects a downstream app request to an optional final image publication |