version: '3.4'

volumes:
  mysql_data:
      driver: local
  realm-export.json:

services:
  keycloak:
      container_name: keycloak
      image: quay.io/keycloak/keycloak:latest
      hostname: keycloak
      volumes:
        - ${PWD}/realm-export.json:/export/realm-export.json
      environment:
        KEYCLOAK_USER: admin
        KEYCLOAK_PASSWORD: admin
        KEYCLOAK_IMPORT: /export/realm-export.json
        KEYCLOAK_ADMIN: admin
        KEYCLOAK_ADMIN_PASSWORD: admin
      ports:
        - 8080:8080
      restart: on-failure
      command:
        - start-dev
      healthcheck:
        test: ["CMD", "curl", "-f", "http://localhost:8080/auth"]
        interval: 30s
        timeout: 3s
        retries: 10
        start_period: 5s
  xrdp:
      container_name: xrdp
      hostname: xrdp
      image: bolkedebruin/docker-ubuntu-xrdp-mate-rdpgw:20.04
      ports:
        - 3389:3389
      restart: on-failure
      volumes:
        - ${PWD}/xrdp_users.txt:/root/createusers.txt
      environment:
        TZ: "Europe/Amsterdam"
  rdpgw:
       build: .
       ports:
         - 9443:9443
       restart: on-failure
       depends_on:
         - keycloak
       healthcheck:
         test: ["CMD", "curl", "-f", "http://keycloak:8080"]
         interval: 30s
         timeout: 10s
         retries: 10
