1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 16:37:18 +00:00

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

View File

@ -32,15 +32,25 @@ build_baseimage()
docker build -t "${BASEIMAGE_NAME}:${VERSION}-${DATE}" . docker build -t "${BASEIMAGE_NAME}:${VERSION}-${DATE}" .
} }
run_backend() build_backend()
{ {
cd $BACKEND_PATH cd $BACKEND_PATH
docker build -t $IMAGE_NAME -f ${BUILD_CONTEXT}/Dockerfile --build-arg BUILD_CONTEXT=$BUILD_CONTEXT --build-arg NOFRONTEND=1 . 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 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 'exit' INT TERM
trap 'kill 0' EXIT trap 'kill 0' EXIT
build_baseimage build_baseimage
run_frontend & run_backend run_frontend & build_and_run_backend
wait wait