#!/bin/bash

absolute_path() {
  (cd "$1" && pwd)
}
scripts_path=$(absolute_path "$(dirname "$0")" )

. "$scripts_path/checkdocker.sh"

if user_can_docker; then
  DOCKER="docker"
else
  # On development workstations docker must run as root.
  # These settings are not related to the privileges that bpm creates runc containers with.
  DOCKER="sudo docker"
fi

$DOCKER pull cfbpm/bpm-ci:latest
$DOCKER run \
  --privileged \
  -v  "${scripts_path}/..:/bpm" \
  -it cfbpm/bpm-ci:latest \
  /bin/bash
