Files
dify/docker/docker-compose.yaml
crazywoola 8ad90a673b chore: replace x-shared-env anchor with env_file, drop template generator
The 1677-line generated docker-compose.yaml was ~440 lines of YAML-anchor
boilerplate (`x-shared-env: &shared-api-worker-env` populated by
`generate_docker_compose` from `.env.example`). Native compose has had
`env_file:` for years and supports interpolation in env files since 2.24,
so the anchor + generator pair was reimplementing what compose does itself.

This commit:

- Removes the `x-shared-env: &shared-api-worker-env` anchor and all
  `<<: *shared-api-worker-env` merges. Services that need the shared
  config (`api`, `worker`, `worker_beat`, `plugin_daemon`) now use
    env_file:
      - .env.example
      - .env
- Deletes `docker/docker-compose-template.yaml` (no longer needed; the
  generated compose file becomes the single source of truth).
- Deletes `docker/generate_docker_compose` (no template, no generation).

`docker/docker-compose.yaml` now contains the full, hand-readable compose
config in 958 lines (was 1677 — a 43% reduction). The default
`docker compose up -d` brings up exactly the same set of services
(api/web/worker/redis/postgres/weaviate/...) via the existing
profile-gating in COMPOSE_PROFILES.

Suggestion from #35925.

Behavior note: shared-config keys are no longer interpolated through
compose, so passing `KEY=value docker compose up -d` from the shell
no longer overrides container env for those keys — set them in
`docker/.env` instead. Service-specific overrides via the
`environment:` block continue to work as before.
2026-05-08 17:11:54 +08:00

33 KiB