#!/usr/bin/env bash

arch=$(uname -a)
if [[ $arch == arm* ]]; then
  SELENIUM_DOCKER_IMAGE=selenium/standalone-chrome:123.0
else
  SELENIUM_DOCKER_IMAGE=seleniarm/standalone-chromium:123.0
fi

start_selenium() {
  begin "Starting selenium  ..."

  print "> SELENIUM_DOCKER_IMAGE: ${SELENIUM_DOCKER_IMAGE}"
  kill_container_if_exist selenium

  docker run \
    --detach \
    --name selenium \
    --net ${DOCKER_NETWORK} \
    -p 4444:4444 \
    --shm-size=2g \
    ${SELENIUM_DOCKER_IMAGE}

  wait_for_message selenium "Started Selenium Standalone"
  end "Selenium ready"
}
