diff --git a/run b/run.sh similarity index 66% rename from run rename to run.sh index 98e1b98a..ef8a4518 100755 --- a/run +++ b/run.sh @@ -1,13 +1,18 @@ #!/bin/bash set -e + cd "${BASH_SOURCE%/*}" +source ./setup.sh + cd frontend -# TODO: fix dependencies in package.json. Ignore NODE_ENV for now. -yarn install --production=false +printf "\nBuilding front end\n\n" + yarn run build +printf "\nBundling front end\n\n" + if [ "$NODE_ENV" != "production" ] then node djangoBundler.js & @@ -20,14 +25,7 @@ cd ../backend export SERVICE_NAME="portal" export SERVICE_IS_ROOT="1" -pip install pipenv - -if [ "$NODE_ENV" != "production" ] -then - pipenv install --dev -else - pipenv install -fi +printf "\nRunning Django server\n\n" pipenv run python ./manage.py migrate --noinput pipenv run python ./manage.py collectstatic --noinput --clear diff --git a/setup.sh b/setup.sh new file mode 100755 index 00000000..ccccac02 --- /dev/null +++ b/setup.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +cd "${BASH_SOURCE%/*}/frontend" + +printf "Setting up Node.js environment\n\n" + +# TODO: fix dependencies in package.json. Ignore NODE_ENV for now. +yarn install --production=false + +cd ../backend + +printf "\nSetting up Python environment\n\n" + +if [ "$NODE_ENV" != "production" ] +then + pipenv install --dev +else + pipenv install +fi + +cd ..