version: '3.7'
services:
  example:
    build: server/php
    ports:
      - 127.0.0.1:80:80
    volumes:
      - .:/var/www/html
  mocha:
    image: blueimp/mocha-chrome
    command: http://example/test
    environment:
      - WAIT_FOR_HOSTS=example:80
    depends_on:
      - example
  chromedriver:
    image: blueimp/chromedriver
    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
    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
    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:/app:ro
      - ./wdio/reports:/app/reports
    depends_on:
      - chromedriver
      - geckodriver
      - example
