pushd "$(git rev-parse --show-toplevel)" > /dev/null

export DEV_ENV_DOCKER_IMAGE=simonsdave/dev-env-dev-env:build

if [ -d ./env ]; then
    source ./env/bin/activate
else
    python3 -m venv env
    source ./env/bin/activate

    pip install --upgrade pip

    curl -s -L -o ./bin/increment_version.sh 'https://raw.githubusercontent.com/fmahnke/shell-semver/master/increment_version.sh'
    chmod a+x ./bin/increment_version.sh

    ./dockerfiles/build-docker-image.sh "${DEV_ENV_DOCKER_IMAGE}"
fi

export PATH="${PWD}/bin":$PATH

popd > /dev/null
