Image variant definitions
The image definitions provide a small set of build choices for Frappe workloads. The bench image supports Bench tool work, while the production, layered, and custom application images package a runnable Frappe environment for different levels of speed and app control. See Container image builds for the wider build model and Image build and publish automation for the pipeline view.
Image variant model
The application variants share one runtime role: they provide a Frappe bench with its apps, built assets, and startup contract. They differ in where their base content comes from and whether the build is fixed to the core apps or can receive an app list.
| Variant | Main purpose | App scope | Build source |
|---|---|---|---|
| Bench | Development and debug work with the Bench command-line tool | Bench tooling rather than a runnable Frappe site | A Debian tool environment |
| Production | Fast use of the standard Frappe and ERPNext image | Frappe and ERPNext only | Builds the framework and ERPNext from their source references |
| Layered | Repeatable custom application images with shorter builds | Frappe plus the apps named by apps.json | Reuses published Frappe base and build images |
| Custom | Custom application images when the base environment must be built locally | Frappe plus the apps named by apps.json | Builds the base environment in the same image definition |
The application image flow separates the common runtime environment from the app content. This diagram shows how the standard image can publish reusable layers and how the two custom paths produce the same kind of runnable backend.
flowchart TD
P[Production Containerfile] --> B[Published base and build layers]
P --> E[Standard Frappe and ERPNext image]
B --> L[Layered Containerfile]
A[apps.json] --> L
C[Custom Containerfile] --> CAPP[Custom application image]
A --> C
L --> LAPP[Layered application image]
Bench image
Bench purpose
The bench image is a user-focused environment for developing or inspecting Frappe projects. It supplies the Bench CLI and the language, database, document, and browser tools needed for local work, but it is not the image for running a complete application stack. The bench-test target checks that the main command-line tools work in both direct and interactive shells.
References: images/…/Dockerfile• L1-11 images/…/Dockerfile• L13-102 images/…/Dockerfile• L104-160 images/…/Dockerfile• L163-178
Application image variants
Production image
The production image is the standard, ready-to-run image for Frappe and ERPNext. It is intended for quick starts and standard deployments where the application set does not need to be changed at image build time. Its published base and build stages also act as reusable core inputs for the layered path.
The image keeps site data and logs outside the image while placing built assets in the image. At container start, the shared entrypoint makes those assets available through the sites volume and then runs the selected service command. This gives frontend, worker, websocket, and one-shot services a common application image contract even when Compose assigns each service a different command.
References: images/…/Containerfile• L1-15 images/…/Containerfile• L95-150 images/…/Containerfile• L156-181 resources/…/main-entrypoint.sh• L4-12
Layered image
The layered image is the preferred custom path when the matching Frappe base and build images are already available. It reuses those published layers, then adds Frappe and the selected apps, so a custom build can be faster and can keep its build inputs separate from the core image release.
The app list is supplied through apps.json. If that list changes, the build must also receive a cache-bust value because secret contents do not form part of the normal layer cache key. The resulting image follows the same site, log, asset, and startup contract as the production image.
References: images/…/Containerfile• L1-10 images/…/Containerfile• L12-32 images/…/Containerfile• L34-63 docs/…/06-automated-builds-and-deployment.md• L20-40
Custom image
The custom image is the self-contained custom application path. It builds its base environment locally instead of depending on published Frappe base and build images, then installs the framework and the apps described by apps.json. Use it when the build needs direct control of the base language or runtime versions, or when a published core layer is not the right input.
The final image has the same broad runtime shape as the layered image. It preserves the shared site and log volumes and uses the common asset-link and startup behavior, so the choice between custom and layered changes the build source rather than the service model.
References: images/…/Containerfile• L1-19 images/…/Containerfile• L21-99 images/…/Containerfile• L102-161 images/…/Containerfile• L163-190 docs/getting-started.md• L83-92
Variant selection
Workload fit
Choose a variant by deciding whether the goal is tool use, a standard core image, or a custom app image. The production image is the simplest standard choice. The layered image is the efficient custom choice when published core layers match the target. The custom image gives the build more independence. The bench image is for development and diagnosis rather than application service containers.
| Need | Variant |
|---|---|
| Use or test the Bench CLI | Bench |
| Run only the standard Frappe and ERPNext apps | Production |
| Add apps with fast builds from published core layers | Layered |
| Add apps while building the base environment locally | Custom |
The normal core build publishes the production image together with reusable base and build targets. The layered workflow then consumes those targets through its image prefix, while custom builds do not need that published-layer relationship. This makes the layer choice a build concern without changing how the final application image runs.
References: docker-bake.hcl• L39-67 docker-bake.hcl• L95-117 .github/…/app-build-image.yml• L132-147 .github/…/app-build-image.yml• L173-189
Change checklist
When these files or sections are changed, remember to consider these:
- If a production build argument or version changes, keep the published
baseandbuildinputs compatible with the layered image and its consuming workflows. - If the app-list or secret handling changes, update both the layered and custom build callers and preserve cache invalidation for changed apps.json content.
- If the application image paths for assets, sites, or logs change, review the common entrypoint and every service that mounts the sites volume.
- If the Bench target or its tool versions change, check the separate
bench-testtarget and the workflow that publishes the bench image. - If the production, layered, or custom startup contract changes, check service commands that use one image for frontend, websocket, worker, and one-shot roles.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A custom app build uses the production variant | The requested apps are not included in the image | Use layered or custom with an apps.json app list |
A layered build cannot find matching published base or build images | The build cannot resolve its core inputs or may use the wrong framework line | Publish and consume layers for the same Frappe branch and image prefix |
| apps.json changes without a changed cache-bust value | A cached app layer can produce an image with an old app set | Derive CACHE_BUST from the app definition or another deliberate rebuild marker |
| A separate nested assets volume is mounted over the sites path | The container can hide the baked assets that the startup entrypoint links into the sites volume | Mount the shared sites volume only and use the image asset link |
| The bench image is assigned to an application service | The service lacks the packaged Frappe application runtime | Use an application image for runtime services and reserve bench for tool work |
Key files
| File | Why to read it |
|---|---|
images/bench/Dockerfile | Defines the tool-oriented bench environment and its validation target. |
images/production/Containerfile | Defines the standard application image and the reusable core layers. |
images/layered/Containerfile | Shows the published-layer path for custom app images and the apps.json boundary. |
images/custom/Containerfile | Shows the self-contained path for custom app images. |
docker-bake.hcl | Connects the production stages to image targets, tags, and the bench targets. |
| resources/…/main-entrypoint.sh | Defines how image assets become visible through the mounted sites volume. |
| resources/…/start.sh | Defines the default backend startup role shared by application images. |
| .github/…/app-build-image.yml | Shows how a custom app list drives layered smoke-test and publish builds. |