From 0a48b6e4f3e2550cd8a7578faa2234f9375c627a Mon Sep 17 00:00:00 2001 From: Mauricio Vidal Date: Fri, 27 Jan 2023 18:29:13 -0500 Subject: [PATCH] Clarification on how to use custom image --- compose.yaml | 12 +++++++++--- docs/custom-apps.md | 13 ++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/compose.yaml b/compose.yaml index ad8bdce5..a290d9ec 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,3 +1,9 @@ +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 + # for using custom images + image: frappe/erpnext:${ERPNEXT_VERSION:?No ERPNext version set} + x-depends-on-configurator: &depends_on_configurator depends_on: configurator: @@ -5,7 +11,7 @@ x-depends-on-configurator: &depends_on_configurator x-backend-defaults: &backend_defaults <<: *depends_on_configurator - image: frappe/erpnext:${ERPNEXT_VERSION:?No ERPNext version set} + <<: *customizable_image volumes: - sites:/home/frappe/frappe-bench/sites @@ -36,7 +42,7 @@ services: <<: *backend_defaults frontend: - image: frappe/erpnext:${ERPNEXT_VERSION} + <<: *customizable_image command: - nginx-entrypoint.sh environment: @@ -56,7 +62,7 @@ services: websocket: <<: *depends_on_configurator - image: frappe/erpnext:${ERPNEXT_VERSION} + image: frappe/erpnext:${ERPNEXT_VERSION:?No ERPNext version set} command: - node - /home/frappe/frappe-bench/apps/frappe/socketio.js diff --git a/docs/custom-apps.md b/docs/custom-apps.md index 57bc7331..32538813 100644 --- a/docs/custom-apps.md +++ b/docs/custom-apps.md @@ -57,7 +57,7 @@ Note: - Use `docker` instead of `buildah` as per your setup. - `FRAPPE_PATH` and `FRAPPE_BRANCH` build args are optional and can be overridden in case of fork/branch or test a PR. - Make sure `APPS_JSON_BASE64` variable has correct base64 encoded JSON string. It is consumed as build arg, base64 encoding ensures it to be friendly with environment variables. Use `jq empty apps.json` to validate `apps.json` file. -- Make sure the `--tag` is valid image name that will be pushed to registry. +- Make sure the `--tag` is valid image name that will be pushed to registry. See section [below](#use-images) for remarks about its use. - Change `--build-arg` as per version of Python, NodeJS, Frappe Framework repo and branch - `.git` directories for all apps are removed from the image. @@ -98,6 +98,17 @@ podman run --rm -it \ More about [kaniko](https://github.com/GoogleContainerTools/kaniko) + ### Use Images +On the [compose.yaml](../compose.yaml) replace the image reference to the `tag` you used when you built it. Then, if you used a tag like `custom_erpnext:staging` the `x-customizable-image` section will look like this: + +``` +x-customizable-image: &customizable_image + image: custom_erpnext:staging + pull_policy: never +``` + +The `pull_policy` above is optional and prevents `docker` to try to download the image when that one has been built locally. + Make sure image name is correct to be pushed to registry. After the images are pushed, you can pull them to servers to be deployed. If the registry is private, additional auth is needed.