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

  cara-webservice:
    image: cara-webservice
    environment:
      - COOKIE_SECRET
      - APP_NAME=cara-webservice
      - CARA_CALCULATOR_PREFIX=/calculator-cern
      - CARA_THEME=cara/apps/templates/cern
    user: ${CURRENT_UID}

  cara-calculator-open:
    image: cara-webservice
    environment:
      - COOKIE_SECRET
      - APP_NAME=cara-webservice
      - CARA_CALCULATOR_PREFIX=/calculator-open
    user: ${CURRENT_UID}

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

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