Collapse long-form env_file back to plain strings for Dokploy
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
This commit is contained in:
parent
0c1b8d7dc3
commit
8b50774ce3
|
|
@ -39,8 +39,7 @@ services:
|
|||
condition: service_started
|
||||
required: true
|
||||
env_file:
|
||||
- path: ./backend/.env
|
||||
required: true
|
||||
- ./backend/.env
|
||||
networks:
|
||||
default: null
|
||||
ports:
|
||||
|
|
|
|||
|
|
@ -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}."
|
||||
|
|
|
|||
Loading…
Reference in New Issue