#!/usr/bin/env bash set -euo pipefail Yellow='\033[0;33m' NoColor='\033[0m' echo -e $Yellow echo " --> Build ReactApp frontend" echo -e $NoColor (cd webapp && exec npm run build) # <<--- https://stackoverflow.com/questions/786376/how-do-i-run-a-program-with-a-different-working-directory-from-current-from-lin #### DEPLOY=backend/src/main/resources/static echo -e $Yellow echo " --> Deploying ReactApp to SpringBoot" echo -e $NoColor rmdir --ignore-fail-on-non-empty --parent ${DEPLOY} && mkdir -p ${DEPLOY} cp -r -v webapp/build/* ${DEPLOY} echo -e $Yellow echo " --> Restarting SpringBoot" echo -e $NoColor (cd backend && exec ./gradlew --stop) (cd backend && exec ./gradlew bootrun -Dorg.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64 2> springboot.err > spingboot.log &) # &> err&log.txt &