Refactor building and running of backend to functions

This commit is contained in:
Kristóf Tóth 2018-03-27 13:45:41 +02:00
parent 8371eb36ef
commit c6e06128bb
1 changed files with 12 additions and 2 deletions

View File

@ -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