#!/usr/bin/env bash

set -euo pipefail

function cleanup() {
    set +e  # prevent error from stopping execution if container doesn't exist
    docker rm -f $CONTAINER_NAME
    set -e
}

trap cleanup SIGINT

cleanup

docker run -e CHUM_TO_JSON_SERVER=http://localhost:9090 -d --rm \
    --network host --name $CONTAINER_NAME $IMAGE_NAME

echo
echo "CONTAINER IS RUNNING"
echo

docker logs --follow $CONTAINER_NAME
