version: '3.9'

services:
  db:
    image: postgres:14    
    restart: always
    environment:
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_DB=bankmanager
    networks:
      - default 
    volumes:
      - {{ service_directory }}/data/db:/var/lib/postgresql/data
    ports:
      - '5432:5432'
      
  app:
    image: git.lehmannhaus.de/tobiaslehmann/de.lehmann.bank.manager:latest    
    environment:
      SPRING_APPLICATION_JSON: '{
        "USER_UID": "{{ service_user_id }}",
        "USER_GID": "{{ service_group_id }}",
        "spring.datasource.url"  : "jdbc:postgresql://db:5432/bankmanager",
        "spring.datasource.username" : "${DB_USER}",
        "spring.datasource.password" : "${DB_PASSWORD}",
        "bank-manager.vendors" : [
          {"id": "Sparkasse Schwäbisch Hall Giro Konto Jana und Tobias Lehmann", "type":"KSK_GIRO", "fileName":"bank-transaction-ksk-giro.csv", "iban":"DE82622500300002371555"},
          {"id": "Ing Diba Giro", "type":"ING_DIBA_GIRO", "fileName":"bank-transaction-ingdiba-giro.csv", "iban":"DE86500105175402169692"},
          {"id": "Ing Diba Extra", "type":"ING_DIBA_EXTRA", "fileName":"bank-transaction-ingdiba-extra.csv", "iban":"DE17500105175503170826"}
        ]
      }'      
    restart: always
    volumes:
      - {{ service_directory }}/data/appdata:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - '80:20000'
    networks:
      - default

networks:
  default:
    ipam:
      driver: default
      config:
        - subnet: 172.2.0.0/16
          gateway: 172.2.0.1