version: '3.7'
services:
  example:
    build: server/php
    ports:
      - 127.0.0.1:80:80
      - ${SERVER_HOST:-127.0.0.1}:${SERVER_PORT-}:80
    volumes:
      - .:/var/www/html
  chromedriver:
    image: blueimp/chromedriver
    init: true
    tmpfs: /tmp
    environment:
      - DISABLE_X11=false
      - ENABLE_VNC=true
      - EXPOSE_X11=true
    volumes:
      - ./wdio/assets:/home/webdriver/assets:ro
    ports:
      - 127.0.0.1:5900:5900
  geckodriver:
    image: blueimp/geckodriver
    init: true
    tmpfs: /tmp
    shm_size: 2g
    environment:
      - DISABLE_X11=false
      - ENABLE_VNC=true
      - EXPOSE_X11=true
    volumes:
      - ./wdio/assets:/home/webdriver/assets:ro
    ports:
      - 127.0.0.1:5901:5900
  wdio:
    image: blueimp/wdio
    init: true
    read_only: true
    tmpfs:
      - /tmp
    environment:
      - WAIT_FOR_HOSTS= chromedriver:4444 geckodriver:4444 example:80
      - WINDOWS_HOST
      - MACOS_ASSETS_DIR=$PWD/wdio/assets/
      - WINDOWS_ASSETS_DIR
    volumes:
      - ./wdio:/opt:ro
      - ./wdio/reports:/opt/reports
    depends_on:
      - chromedriver
      - geckodriver
      - example
