From c6e06128bb5020e068830c415699832fd31e39ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 27 Mar 2018 13:45:41 +0200 Subject: [PATCH] Refactor building and running of backend to functions --- hack/tfw_magic_start.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hack/tfw_magic_start.sh b/hack/tfw_magic_start.sh index b52a33d..5949ae2 100755 --- a/hack/tfw_magic_start.sh +++ b/hack/tfw_magic_start.sh @@ -32,15 +32,25 @@ build_baseimage() docker build -t "${BASEIMAGE_NAME}:${VERSION}-${DATE}" . } -run_backend() +build_backend() { cd $BACKEND_PATH docker build -t $IMAGE_NAME -f ${BUILD_CONTEXT}/Dockerfile --build-arg BUILD_CONTEXT=$BUILD_CONTEXT --build-arg NOFRONTEND=1 . +} + +run_backend() +{ docker run --rm -p $BACKEND_PORT:$BACKEND_PORT -e AVATAO_SECRET=$AVATAO_SECRET $IMAGE_NAME } +build_and_run_backend() +{ + build_backend + run_backend +} + trap 'exit' INT TERM trap 'kill 0' EXIT build_baseimage -run_frontend & run_backend +run_frontend & build_and_run_backend wait