version: '3.8'
services:
  postgresdb:
    container_name: postgresDb
    image: postgres
    restart: always
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    networks:
      - base-system-network

  mongodb:
    container_name: mongodb
    image: mongo:4.4.12
    restart: always
    ports:
      - "27017:27017"
    volumes:
      - mongodb:/data/db
    networks:
      - base-system-network

  backend:
    container_name: base-system-backend
    image: kaulsdorfit/base-system:latest
    #    image: base-system-backend
    #    build:
    #      context: .
    restart: no
    ports:
      - "8080:8080"
    depends_on:
      - postgresdb
      - mongodb
    volumes:
      - files:/usr/src/app/files
    environment:
      - APP_ID=Demo Instance
      - APP_ENVIRONMENT=CONFIG # one of: CONFIG, ACCEPTANCE or PRODUCTION
      - HOST_NAME=localhost
      - HOST_PORT=8080
      - PROTOCOL=http

      - CLIENT_PORT=80

      - MONGODB_URL=mongodb
      - MONGODB_PORT=27017
      - MONGODB_SCHEMA_NAME=base-system

      - POSTGRES_HOST=postgresDb
      - POSTGRES_PORT=5432
      - POSTGRES_USER=postgres
      - POSTGRES_SCHEMA_NAME=public

      - OAUTH2_GOOGLE_CLIENT_ID=649114655396-91dafmerfh51rc41urosgfrcjhvctp0d.apps.googleusercontent.com
      - OAUTH2_GOOGLE_SECRET=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

      - OAUTH2_ENTRA_ID_CLIENT_ID=c2e3168d-edeb-4002-8be0-1033c164a71f
      - OAUTH2_ENTRA_ID_CLIENT_SECRET=YDS8Q~qR_h1TYGxtaY66J1-OX8y2LtgHu~hKNcUw
      - OAUTH2_ENTRA_ID_OBJECT_ID=5530f8b0-94ae-4e9c-9f07-996f5c7a3296
      - OAUTH2_ENTRA_ID_TENANT_ID=4ab0ea39-2bdd-43ea-baa2-ed6f757dedd8

      - ADMIN_ROLE=n/a.AppDeveloper
      - STORAGE_LOCATION=files
    networks:
      - base-system-network

  webProxy:
    image: nginx:latest
    container_name: webProxy
    restart: unless-stopped
    ports:
      - "80:80"
    volumes:
      - ./nginx-config/default.conf:/etc/nginx/conf.d/default.conf
    networks:
      - base-system-network
    environment:
      DEFAULT_HOST: localhost

volumes:
  pgdata:
  mongodb:
  files:

networks:
  base-system-network:
    driver: bridge
