networks:
  dev:
    driver: bridge
services:
  postgresdb:
    image: postgres
    container_name: ${DOCKER_REGISTRY-}postgresql-db      
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=FamilyTreeDB
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=Positive~1
      - PGDATA=/var/lib/postgresql/data/pgdata
    restart: always
    volumes:
      - postgresdata:/var/lib/postgresql/data
    networks:
      - dev
  pgadmin:
    image: dpage/pgadmin4
    container_name: pgadmin4_container    
    restart: always
    depends_on: 
      - "postgresdb"
    volumes:
      - pgadmin-data:/var/lib/pgadmin
    environment:
      PGADMIN_DEFAULT_EMAIL: postgres@domain.com
      PGADMIN_DEFAULT_PASSWORD: Positive~1
    ports:
      - "5050:5050"
    networks:
      - dev
  familytreeui:
    image: ${DOCKER_REGISTRY-}familytreeui
    depends_on:
      - "familytreeapi"
    ports:
      - "4200:80"
    build:
      context: UI
      dockerfile: Dockerfile
    container_name: familytreeui
    volumes:
      - ./:/app      
    networks:
      - dev
  familytreeapi:
    image: ${DOCKER_REGISTRY-}familytreeapi
    container_name: familytreeapi-services
    depends_on: 
      - "postgresdb"
    environment:
      - "Logging:Microsoft.AspNetCore.DataProtection:None"
      - "AppSettings:SQLConnectionString=host=postgresdb;database=FamilyTreeDB;username=postgres;password=Positive~1"
    volumes:       
      - app_import:/home/kham/dvolumes/app_import
      - app_images:/home/kham/dvolumes/app_images 
    ports:
      - "8080:8080"
    build:
      context: .
      dockerfile: FamilyTreeAPI/Dockerfile
    networks:
      - dev  
volumes:
  myapikey:
    external: true
  pgadmin-data:
    external: true
  postgresdata:
    external: true
