frappe_docker/compose.yaml
google-labs-jules[bot] 6b425133e4 feat: Configure docker-compose to build all Frappe apps
Modified the `compose.yaml` file to enable the building of a custom Docker image that includes a comprehensive suite of Frappe applications as requested by the user.

The changes leverage the existing `apps.json` file, which already lists all the desired applications (erpnext, hrms, crm, helpdesk, drive, studio, wiki, insights, and books).

The `x-customizable-image` anchor in `compose.yaml` has been updated to:
- Use a local build context.
- Point to the `images/layered/Containerfile` for an efficient build process.
- Pass the base64-encoded content of `apps.json` as a build argument.
- Set the pull policy to 'never' to ensure the locally built image is used.

This makes the setup self-contained, allowing users to build and run the full suite of applications with a standard `docker compose up` command, without needing to manually build the image or manage environment variables for the image name.
2025-09-07 22:30:34 +00:00

104 lines
4 KiB
YAML

x-customizable-image: &customizable_image
# By default the image used only contains the `frappe` and `erpnext` apps.
# See https://github.com/frappe/frappe_docker/blob/main/docs/custom-apps.md
# about using custom images.
#
# This setup is modified to build a custom image with the apps defined in `apps.json`.
image: frappe-custom:latest
build:
context: .
dockerfile: images/layered/Containerfile
args:
FRAPPE_PATH: https://github.com/frappe/frappe
FRAPPE_BRANCH: version-15
APPS_JSON_BASE64: WwogIHsKICAgICJnaXRfdXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9mcmFwcGUvZXJwbmV4dCIsCiAgICAiYnJhbmNoIjogInZlcnNpb24tMTUiCiAgfSwKICB7CiAgICAiZ2l0X3VybCI6ICJodHRwczovL2dpdGh1Yi5jb20vZnJhcHBlL2hybXMiLAogICAgImJyYW5jaCI6ICJtYWluIgogIH0sCiAgewogICAgImdpdF91cmwiOiAiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9jcm0iLAogICAgImJyYW5jaCI6ICJtYWluIgogIH0sCiAgewogICAgImdpdF91cmwiOiAiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9oZWxwZGVzayIsCiAgICAiYnJhbmNoIjogIm1haW4iCiAgfSwKICB7CiAgICAiZ2l0X3VybCI6ICJodHRwczovL2dpdGh1Yi5jb20vZnJhcHBlL2RyaXZlIiwKICAgICJicmFuY2giOiAibWFpbiIKICB9LAogIHsKICAgICJnaXRfdXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9mcmFwcGUvc3R1ZGlvIiwKICAgICJicmFuY2giOiAibWFpbiIKICB9LAogIHsKICAgICJnaXRfdXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9mcmFwcGUvd2lraSIsCiAgICAiYnJhbmNoIjogIm1haW4iCiAgfSwKICB7CiAgICAiZ2l0X3VybCI6ICJodHRwczovL2dpdGh1Yi5jb20vZnJhcHBlL2luc2lnaHRzIiwKICAgICJicmFuY2giOiAibWFpbiIKICB9LAogIHsKICAgICJnaXRfdXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9mcmFwcGUvYm9va3MiLAogICAgImJyYW5jaCI6ICJtYWluIgogIH0KXQo=
pull_policy: never
restart: ${RESTART_POLICY:-unless-stopped}
x-depends-on-configurator: &depends_on_configurator
depends_on:
configurator:
condition: service_completed_successfully
x-backend-defaults: &backend_defaults
<<: [*depends_on_configurator, *customizable_image]
volumes:
- sites:/home/frappe/frappe-bench/sites
services:
configurator:
<<: *backend_defaults
platform: linux/amd64
entrypoint:
- bash
- -c
# add redis_socketio for backward compatibility
command:
- >
ls -1 apps > sites/apps.txt;
bench set-config -g db_host $$DB_HOST;
bench set-config -gp db_port $$DB_PORT;
bench set-config -g redis_cache "redis://$$REDIS_CACHE";
bench set-config -g redis_queue "redis://$$REDIS_QUEUE";
bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
bench set-config -gp socketio_port $$SOCKETIO_PORT;
environment:
DB_HOST: ${DB_HOST:-}
DB_PORT: ${DB_PORT:-}
REDIS_CACHE: ${REDIS_CACHE:-}
REDIS_QUEUE: ${REDIS_QUEUE:-}
SOCKETIO_PORT: 9000
depends_on: {}
restart: on-failure
backend:
<<: *backend_defaults
platform: linux/amd64
frontend:
<<: *customizable_image
platform: linux/amd64
command:
- nginx-entrypoint.sh
environment:
BACKEND: backend:8000
SOCKETIO: websocket:9000
FRAPPE_SITE_NAME_HEADER: ${FRAPPE_SITE_NAME_HEADER:-$$host}
UPSTREAM_REAL_IP_ADDRESS: ${UPSTREAM_REAL_IP_ADDRESS:-127.0.0.1}
UPSTREAM_REAL_IP_HEADER: ${UPSTREAM_REAL_IP_HEADER:-X-Forwarded-For}
UPSTREAM_REAL_IP_RECURSIVE: ${UPSTREAM_REAL_IP_RECURSIVE:-off}
PROXY_READ_TIMEOUT: ${PROXY_READ_TIMEOUT:-120}
CLIENT_MAX_BODY_SIZE: ${CLIENT_MAX_BODY_SIZE:-50m}
volumes:
- sites:/home/frappe/frappe-bench/sites
depends_on:
- backend
- websocket
websocket:
<<: [*depends_on_configurator, *customizable_image]
platform: linux/amd64
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
volumes:
- sites:/home/frappe/frappe-bench/sites
queue-short:
<<: *backend_defaults
platform: linux/amd64
command: bench worker --queue short,default
queue-long:
<<: *backend_defaults
platform: linux/amd64
command: bench worker --queue long,default,short
scheduler:
<<: *backend_defaults
platform: linux/amd64
command: bench schedule
# ERPNext requires local assets access (Frappe does not)
volumes:
sites: