a handy build script

This commit is contained in:
djmil 2023-12-05 13:49:09 +01:00
parent 3c5a696be2
commit 6de3d679e2
2 changed files with 36 additions and 1 deletions

5
.gitignore vendored
View File

@ -5,6 +5,11 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/
springboot.err
spingboot.log
err&log.txt
### STS ###
.apt_generated
.classpath

30
runFront2Back Normal file
View File

@ -0,0 +1,30 @@
#!/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 &