version: "3.8"
services:
  expert-app:
    image: calculator-app
    environment:
      - APP_NAME=caimira-voila
    user: ${CURRENT_UID:?"Please run as follows 'CURRENT_UID=$(id -u):$(id -g) docker-compose up'"}

  expert-co2-app:
    image: calculator-app
    environment:
      - APP_NAME=caimira-co2-voila
    user: ${CURRENT_UID:?"Please run as follows 'CURRENT_UID=$(id -u):$(id -g) docker-compose up'"}

  calculator-app:
    image: calculator-app
    environment:
      - COOKIE_SECRET
      - APP_NAME=calculator-app
      - APPLICATION_ROOT=/
      - CAIMIRA_CALCULATOR_PREFIX=/calculator-cern
      - CAIMIRA_THEME=caimira/apps/templates/cern
      - DATA_SERVICE_ENABLED=False
    user: ${CURRENT_UID}

  calculator-open-app:
    image: calculator-app
    environment:
      - COOKIE_SECRET
      - APP_NAME=calculator-app
      - APPLICATION_ROOT=/
      - CAIMIRA_CALCULATOR_PREFIX=/calculator-open
      - DATA_SERVICE_ENABLED=False
    user: ${CURRENT_UID}

  auth-service:
    image: auth-service
    environment:
      - COOKIE_SECRET
      - OIDC_SERVER
      - OIDC_REALM
      - CLIENT_ID
      - CLIENT_SECRET
    user: ${CURRENT_UID}

  caimira-router:
    image: caimira-nginx-app
    ports:
      - "8080:8080"
    depends_on:
      calculator-app:
        condition: service_started
      calculator-open-app:
        condition: service_started
      expert-app:
        condition: service_started
      expert-co2-app:
        condition: service_started
      auth-service:
        condition: service_started
    user: ${CURRENT_UID}
