#!/bin/bash
export COMPOSE_PROJECT_NAME=sdbapi
function confirm() {
echo -n "$@ [y/N]: "
read -e answer
for response in y Y
do
if [ "_$answer" == "_$response" ]
then
return 0
fi
done
# default to no
return 1
}
confirm reset containers? && docker-compose down
confirm reset database? && docker volume rm sdbapi_apidb_data
confirm rebuild api? && docker-compose build
confirm launch? && docker-compose up