From 1b33fc6c114f75b056359f0a45494dc8ebc335a0 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 17 Jan 2023 19:40:41 +0530 Subject: [PATCH] ci: remove .git dir to skip fetch_details_from_tag fixes https://github.com/frappe/frappe_docker/actions/runs/3938883301/jobs/6738091655 --- docs/custom-apps.md | 2 +- images/custom/Containerfile | 5 +---- images/production/Containerfile | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/custom-apps.md b/docs/custom-apps.md index 7d79414f..e00696cd 100644 --- a/docs/custom-apps.md +++ b/docs/custom-apps.md @@ -59,7 +59,7 @@ Note: - 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. - Change `--build-arg` as per version of Python, NodeJS, Frappe Framework repo and branch -- Set `--build-arg=REMOVE_GIT_REMOTE=true` to remove git upstream remotes from all apps. Use this in case they have secrets or private tokens and you don't wish to ship them in final image. +- `.git` directories for all apps are removed from the image. ### Push image to use in yaml files diff --git a/images/custom/Containerfile b/images/custom/Containerfile index 266ede78..23e04684 100644 --- a/images/custom/Containerfile +++ b/images/custom/Containerfile @@ -99,7 +99,6 @@ RUN if [ -n "${APPS_JSON_BASE64}" ]; then \ USER frappe -ARG REMOVE_GIT_REMOTE ARG FRAPPE_BRANCH=version-14 ARG FRAPPE_PATH=https://github.com/frappe/frappe RUN export APP_INSTALL_ARGS="" && \ @@ -117,9 +116,7 @@ RUN export APP_INSTALL_ARGS="" && \ cd /home/frappe/frappe-bench && \ echo "$(jq 'del(.db_host, .redis_cache, .redis_queue, .redis_socketio)' sites/common_site_config.json)" \ > sites/common_site_config.json && \ - if [ -n "${REMOVE_GIT_REMOTE}" ]; then \ - find apps -name .git -type d -prune | xargs -i git --git-dir {} remote rm upstream; \ - fi + find apps -mindepth 1 -path "*/.git" | xargs rm -fr WORKDIR /home/frappe/frappe-bench diff --git a/images/production/Containerfile b/images/production/Containerfile index cd0010ca..60b8bc3e 100644 --- a/images/production/Containerfile +++ b/images/production/Containerfile @@ -109,7 +109,7 @@ RUN bench init \ bench get-app --branch=${ERPNEXT_BRANCH} --resolve-deps erpnext ${ERPNEXT_REPO} && \ echo "$(jq 'del(.db_host, .redis_cache, .redis_queue, .redis_socketio)' sites/common_site_config.json)" \ > sites/common_site_config.json && \ - find apps -name .git -type d -prune | xargs -i git --git-dir {} remote rm upstream + find apps -mindepth 1 -path "*/.git" | xargs rm -fr FROM base as erpnext