#!/bin/bash

set -e

if [[ -n "${STACTOOLS_DEBUG}" ]]; then
    set -x
fi

source $(dirname "$0")/env

function usage() {
    echo -n \
        "Usage: $(basename "$0")
Launches a Jupyter notebook in a docker container with all prerequisites installed.
"
}

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
    docker run --rm -it \
        -v `pwd`:/opt/stactools \
        -v ${HOME}/.planet.json:/root/.planet.json:ro \
        --entrypoint jupyter \
        -p 8888:8888 \
        $DOCKER_REGISTRY/$DOCKER_ORG/$DOCKER_REPO:$DOCKER_TAG_DEV \
        notebook \
        --ip=0.0.0.0 \
        --port=8888 \
        --no-browser \
        --allow-root \
        --notebook-dir=/opt/stactools
fi
