From 8a80797d1404329549279d7ca8d3468a09041439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sat, 3 Mar 2018 14:16:27 +0100 Subject: [PATCH] Add simple script to start development backend & frontend --- tfw_magic_start.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tfw_magic_start.sh diff --git a/tfw_magic_start.sh b/tfw_magic_start.sh new file mode 100755 index 0000000..30af1e2 --- /dev/null +++ b/tfw_magic_start.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -e + +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 +} + +trap 'kill %1; kill %2' SIGINT +run_frontend & run_backend +