docker-discourse icon indicating copy to clipboard operation
docker-discourse copied to clipboard

Less redundant compose file

Open frafra opened this issue 1 year ago • 0 comments

Description of the feature Hi! YAML support anchors, and compose files can use them as well. This, together with defining the environment sections as mapping instead of lists, allow having a more compact and less redundant compose file.

Benefits of feature

Set the variables just once; more compact and readable compose file.

Additional context

Example:

version: '2.4'
x-common-environment:
  &default-common-environment
  TIMEZONE: Europe/Oslo
  DB_HOST: discourse-db
  DB_NAME: discourse
  DB_USER: discourse
  DB_PASS: password
services:
  discourse-app:
   image: tiredofit/discourse:latest
    environment:
     << : *default-common-environment
      CONTAINER_NAME: discourse-app
  # ...
  discourse-db-backup:
    image: tiredofit/db-backup
    environment:
      << : *default-common-environment
      CONTAINER_NAME: discourse-db-backup
      DB_TYPE: postgres
      DB_DUMP_FREQ: 1440
      DB_DUMP_BEGIN: 0000
      DB_CLEANUP_TIME: 8640

frafra avatar May 04 '23 10:05 frafra