From 87870be936ecceac58b6e3e5315815509b4c0622 Mon Sep 17 00:00:00 2001 From: Mauricio Vidal <13444566+maovidal@users.noreply.github.com> Date: Wed, 1 Feb 2023 11:42:08 -0500 Subject: [PATCH] Clarification on how to use custom image (#1062) * Clarification on how to use custom image * chore: fix lint * refactor: websocket uses also customizable_image --------- Co-authored-by: Mauricio Vidal --- compose.yaml | 12 +++++++++--- docs/custom-apps.md | 12 +++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/compose.yaml b/compose.yaml index ad8bdce5..a883e1e0 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 + # about 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} + <<: *customizable_image command: - node - /home/frappe/frappe-bench/apps/frappe/socketio.js diff --git a/docs/custom-apps.md b/docs/custom-apps.md index 57bc7331..618013e3 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. @@ -100,4 +100,14 @@ 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.