From 8b50774ce36f0851a7fd800dc2ff0b0ec993983f Mon Sep 17 00:00:00 2001 From: JasonFraser Date: Fri, 2 Oct 2026 05:21:56 -0400 Subject: [PATCH] Collapse long-form env_file back to plain strings for Dokploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirmed on a real deploy: Dokploy's validator also rejects Compose's long-form env_file entries (services.backend-billing.env_file.0 must be a string). docker compose config always expands env_file to the long form with no flag to suppress it (--no-normalize doesn't affect this). Added a targeted post-processing filter to generate-dokploy-compose.sh that collapses it back — semantically identical, since the short form already implies the file must exist. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y --- docker-compose.dokploy.yml | 3 +-- generate-dokploy-compose.sh | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docker-compose.dokploy.yml b/docker-compose.dokploy.yml index dc95ba5..eb6fa1d 100644 --- a/docker-compose.dokploy.yml +++ b/docker-compose.dokploy.yml @@ -39,8 +39,7 @@ services: condition: service_started required: true env_file: - - path: ./backend/.env - required: true + - ./backend/.env networks: default: null ports: diff --git a/generate-dokploy-compose.sh b/generate-dokploy-compose.sh index 7c1b766..1692851 100755 --- a/generate-dokploy-compose.sh +++ b/generate-dokploy-compose.sh @@ -29,6 +29,20 @@ # which is what actually works once Dokploy clones this repo to its own, # different path on the VPS. # +# A second, separate Dokploy validator limitation, also confirmed on a real +# deploy: it rejects Compose's long-form `env_file` entries too — +# `services.backend-billing.env_file.0 must be a string` — because +# `docker compose config` always expands `env_file: [./backend/.env]` to +# the long form (`- path: ./backend/.env` / `required: true`) in its output, +# with no flag to suppress it (checked: --no-normalize doesn't affect this +# either). The Python filter below collapses that structure back to the +# plain string form, for every service, not just backend-billing — safe to +# do broadly, since the short form already implies "must exist", the exact +# behavior `required: true` spells out. Left alone: `depends_on`'s own, +# unrelated `required:` field (a different Compose feature entirely, and +# not something Dokploy's validator objects to), which this filter's regex +# only matches directly beneath a `- path:` line, not there. +# # Usage: ./generate-dokploy-compose.sh # Run this any time docker-compose.yml changes, or any time frappe_docker # is repointed at a different pinned commit (see .gitmodules) — this file @@ -49,7 +63,14 @@ OUT="docker-compose.dokploy.yml" echo "# docker-compose.yml itself, which Dokploy's validator rejects (see" echo "# this script's own header comment for why)." echo "#" - docker compose -f docker-compose.yml config --no-interpolate --no-path-resolution + docker compose -f docker-compose.yml config --no-interpolate --no-path-resolution \ + | python3 -c " +import sys, re +text = sys.stdin.read() +pattern = re.compile(r'^(\s*)- path: (.+)\n\s*required: (?:true|false)\s*\$', re.MULTILINE) +text = pattern.sub(lambda m: f'{m.group(1)}- {m.group(2)}', text) +sys.stdout.write(text) +" } > "$OUT" echo "Wrote ${OUT}."