From 6de3d679e26dad7d7e271316bd914205bba4acf3 Mon Sep 17 00:00:00 2001 From: djmil Date: Tue, 5 Dec 2023 13:49:09 +0100 Subject: [PATCH] a handy build script --- .gitignore | 7 ++++++- runFront2Back | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 runFront2Back diff --git a/.gitignore b/.gitignore index 46f305c..eb6e64d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,11 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ +springboot.err +spingboot.log +err&log.txt + + ### STS ### .apt_generated .classpath @@ -42,4 +47,4 @@ backend/src/main/resources/static/favicon.ico backend/src/main/resources/static/index.html backend/src/main/resources/static/manifest.json backend/src/main/resources/static/robots.txt -backend/src/main/resources/static/static/* \ No newline at end of file +backend/src/main/resources/static/static/* diff --git a/runFront2Back b/runFront2Back new file mode 100644 index 0000000..2684505 --- /dev/null +++ b/runFront2Back @@ -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 & +