fix(compose): use env_file array form for builtin_models compatibility

PR #1453 introduced the map form of env_file:

  env_file:
    - path: .env
      required: false

which is only recognised by Docker Compose v2.24+ (Jan 2024). Older
deploys would refuse to parse docker-compose.yml even when builtin_models
YAML is not enabled — breaking the "no impact unless opted in" promise.

Switch to the array form (`env_file: [.env]`) which has been supported
since the earliest Compose schemas. The trade-off is that Compose now
errors when .env is absent, so:

- scripts/start_all.sh already calls check_env_file (cp .env.example .env
  if missing) before docker compose up; that path is unaffected.
- The bare `make docker-run` / `make docker-restart` targets in the
  Makefile are taught the same fallback: touch / copy .env.example before
  invoking docker-compose, so fresh clones keep working.

The docker-compose.yml comment block is updated to explain the version
trade-off so future maintainers don't re-introduce the map form.
This commit is contained in:
wizardchen
2026-05-26 11:20:37 +08:00
committed by lyingbug
parent 7b192e546f
commit ea47dce337
2 changed files with 17 additions and 6 deletions
+6
View File
@@ -123,7 +123,12 @@ docker-build-frontend:
docker-build-all: docker-build-app docker-build-docreader docker-build-frontend
# Run Docker container (传统方式)
# Touch .env if missing — docker-compose.yml's `env_file: [.env]` is required
# for ${ENV} interpolation in builtin_models.yaml and would otherwise refuse
# to parse on fresh clones. `start-all` handles this via check_env_file; this
# direct path needs its own guard.
docker-run:
@[ -f .env ] || ([ -f .env.example ] && cp .env.example .env || touch .env)
docker-compose up
# 使用新脚本启动所有服务
@@ -164,6 +169,7 @@ clean-images:
# Restart Docker container (stop, start)
docker-restart:
@[ -f .env ] || ([ -f .env.example ] && cp .env.example .env || touch .env)
docker-compose stop -t 60
docker-compose up