fix(easy-docker): pass apps.json as a build secret

This commit is contained in:
RocketQuack 2026-04-20 23:36:34 +02:00
parent 74f41a3948
commit 0a4b85f401
3 changed files with 3 additions and 22 deletions

View file

@ -11,7 +11,6 @@ build_stack_custom_image() {
local frappe_path="https://github.com/frappe/frappe"
local repo_root=""
local containerfile_path=""
local apps_json_base64=""
local apps_refs_lines=""
local app_ref_line=""
local app_url=""
@ -89,15 +88,6 @@ build_stack_custom_image() {
${apps_refs_lines}
EOF
if ! command_exists base64; then
return 18
fi
apps_json_base64="$(base64 "${apps_json_path}" | tr -d '\r\n')"
if [ -z "${apps_json_base64}" ]; then
return 19
fi
repo_root="$(get_easy_docker_repo_root)"
containerfile_path="${repo_root}/images/layered/Containerfile"
if [ ! -f "${containerfile_path}" ]; then
@ -110,7 +100,7 @@ EOF
-f "${containerfile_path}" \
--build-arg "FRAPPE_BRANCH=${frappe_branch}" \
--build-arg "FRAPPE_PATH=${frappe_path}" \
--build-arg "APPS_JSON_BASE64=${apps_json_base64}" \
--secret "id=apps_json,src=${apps_json_path}" \
-t "${image_ref}" \
"${repo_root}" || return 21

View file

@ -51,12 +51,6 @@ run_build_stack_custom_image_with_feedback() {
17)
show_warning_and_wait "Custom image build failed: apps.json not found after generation." 4
;;
18)
show_warning_and_wait "Custom image build failed: base64 command is not available in this environment." 4
;;
19)
show_warning_and_wait "Custom image build failed: apps.json could not be base64-encoded." 4
;;
20)
show_warning_and_wait "Custom image build failed: images/layered/Containerfile not found." 4
;;

View file

@ -214,7 +214,7 @@ EOF
[ "${status}" -eq 25 ]
}
@test "build_stack_custom_image parses apps.json with jq before git branch checks" {
@test "build_stack_custom_image parses apps.json with jq before git branch checks and passes apps.json as a build secret" {
local sandbox_root=""
local stack_dir=""
local env_path=""
@ -252,10 +252,6 @@ EOF
"printf '%s\n' \"docker \$*\" >>\"${docker_log}\"" \
'exit 0'
easy_docker_test_write_bin_command base64 \
'set -euo pipefail' \
'printf "%s\n" "W3sidXJsIjogImh0dHBzOi8vZXhhbXBsZS5pbnZhbGlkL2FwcCIsICJicmFuY2giOiAidmVyc2lvbi0xNiJ9XQ=="'
easy_docker_test_prepend_bin_dir
run build_stack_custom_image "${stack_dir}"
@ -270,4 +266,5 @@ EOF
run cat "${docker_log}"
[ "${status}" -eq 0 ]
[[ "${output}" == *'docker build -f '* ]]
[[ "${output}" == *"--secret id=apps_json,src=${stack_dir}/apps.json"* ]]
}