From f2541575b4220ff29062ffb633d09e2805853843 Mon Sep 17 00:00:00 2001 From: Florent Guiotte Date: Thu, 13 Apr 2023 11:28:23 +0200 Subject: [PATCH] Refactor common environment --- docker-compose.yml | 70 +++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1881369..6f00843 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,9 @@ -version: '3' +version: '3.4' + +x-common-environment: &common-environment + PUID: 1000 + PGID: 1000 + TZ: Europe/Helsinki services: @@ -11,8 +16,7 @@ services: - ./bind9/local.db:/etc/bind/local.db - ./bind9/lan.db:/etc/bind/lan.db - ./bind9/guiotte.db:/etc/bind/guiotte.db - environment: - - TZ=Europe/Helsinki + environment: *common-environment ports: - "53:53/udp" @@ -23,14 +27,12 @@ services: cap_add: - NET_ADMIN environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Helsinki - - URL=guiotte.fr - - SUBDOMAINS=wildcard - - VALIDATION=dns - - DNSPLUGIN=ovh - - EMAIL=florent@guiotte.fr + <<: *common-environment + URL: guiotte.fr + SUBDOMAINS: wildcard + VALIDATION: dns + DNSPLUGIN: ovh + EMAIL: florent@guiotte.fr volumes: - ./swag:/config ports: @@ -41,10 +43,7 @@ services: image: lscr.io/linuxserver/ddclient:latest container_name: ddclient restart: unless-stopped - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Helsinki + environment: *common-environment volumes: - ./ddclient:/config @@ -111,10 +110,7 @@ services: image: lscr.io/linuxserver/syncthing:latest container_name: syncthing hostname: drmanhattan #optional - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Helsinki + environment: *common-environment volumes: - ./syncthing:/config - /mnt/storage/music/Florent:/music @@ -133,13 +129,11 @@ services: volumes: - lychee-db:/config environment: - - MYSQL_ROOT_PASSWORD=rootpassword - - MYSQL_DATABASE=lychee - - MYSQL_USER=lychee - - MYSQL_PASSWORD=dbpassword - - PGID=1000 - - PUID=1000 - - TZ=Europe/Helsinki + <<: *common-environment + MYSQL_ROOT_PASSWORD: rootpassword + MYSQL_DATABASE: lychee + MYSQL_USER: lychee + MYSQL_PASSWORD: dbpassword lychee: @@ -152,14 +146,12 @@ services: - lychee-config:/config - lychee-pictures:/pictures environment: - - DB_HOST=lychee-db - - DB_USERNAME=lychee - - DB_PASSWORD=dbpassword - - DB_DATABASE=lychee - - DB_PORT=3306 - - PGID=1000 - - PUID=1000 - - TZ=Europe/Helsinki + <<: *common-environment + DB_HOST: lychee-db + DB_USERNAME: lychee + DB_PASSWORD: dbpassword + DB_DATABASE: lychee + DB_PORT: 3306 # WIP # zotero: @@ -188,10 +180,7 @@ services: container_name: taskserver hostname: dm.guiotte.fr restart: always - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Helsinki + environment: *common-environment env_file: - taskserver/taskserver.env ports: @@ -206,10 +195,7 @@ services: build: slides-notes container_name: slides-notes restart: always - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Helsinki + environment: *common-environment volumes: - ./slides-notes/slides:/app/slides