2018-03-03 13:16:27 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2018-03-05 12:57:40 +00:00
|
|
|
TAO_PATH="${TAO_PATH:-$(dirname $(readlink -f $0))/..}"
|
2018-03-03 13:16:27 +00:00
|
|
|
BACKEND_REPO="${BACKEND_REPO:-tutorial-framework-wip}"
|
|
|
|
FRONTEND_REPO="${FRONTEND_REPO:-tutorial-framework-ng}"
|
|
|
|
BACKEND_PATH="${TAO_PATH}/${BACKEND_REPO}"
|
|
|
|
FRONTEND_PATH="${TAO_PATH}/${FRONTEND_REPO}"
|
|
|
|
|
|
|
|
IMAGE_NAME="${IMAGE_NAME:-tfw}"
|
|
|
|
BACKEND_PORT="${BACKEND_PORT:-8888}"
|
|
|
|
AVATAO_SECRET="${AVATAO_SECRET:-secret}"
|
|
|
|
|
|
|
|
function run_frontend()
|
|
|
|
{
|
|
|
|
cd $FRONTEND_PATH
|
|
|
|
yarn start
|
|
|
|
}
|
|
|
|
|
|
|
|
function run_backend()
|
|
|
|
{
|
|
|
|
cd $BACKEND_PATH
|
|
|
|
docker build -t $IMAGE_NAME .
|
|
|
|
docker run --rm -p $BACKEND_PORT:$BACKEND_PORT -e AVATAO_SECRET=$AVATAO_SECRET $IMAGE_NAME
|
|
|
|
}
|
|
|
|
|
2018-03-03 20:59:34 +00:00
|
|
|
trap 'exit' INT TERM
|
|
|
|
trap 'kill 0' EXIT
|
2018-03-03 13:16:27 +00:00
|
|
|
run_frontend & run_backend
|
2018-03-03 20:59:34 +00:00
|
|
|
wait
|