version: '3.8'

networks:
  traefik-public:
    external: true
  smartcity-shared:
    external: true

services:
  iot-agent-ui-bff:
    container_name: smart-city-iot-agent-ui-bff
    build: /home/eric/fiware/iotagent-ui/iotagent-ui-bff
    restart: unless-stopped
    environment:
      - KEYCLOAK_URL=
      - KEYCLOAK_REALM=
      - KEYCLOAK_CLIENT_ID=
      - KEYCLOAK_AUTHORIZED_ROLE=
      - BFF_API_BASE_URL=http://smart-city-iot-agent-ui-bff:9000/api/v1
    networks:
      - smartcity-shared
    ports:
      - "9000:9000"

  iot-agent-ui-spa:
    container_name: smart-city-iot-agent-ui-spa
    build: /home/eric/fiware/iotagent-ui/iotagent-ui-spa
    restart: unless-stopped
    environment:
      - BFF_API_BASE_URL=http://smart-city-iot-agent-ui-bff:9000/api/v1
      - APP_BASE_HREF=/
    networks:
      - smartcity-shared
      - traefik-public
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.iot-agent-ui.rule=Host(`iot-agent-ui.digitribe.fr`)"
      - "traefik.http.routers.iot-agent-ui.entrypoints=websecure"
      - "traefik.http.routers.iot-agent-ui.tls=true"
      - "traefik.http.services.iot-agent-ui.loadbalancer.server.port=80"
