forked from TimeEnjoyed/codejam2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·41 lines (30 loc) · 760 Bytes
/
build.sh
File metadata and controls
executable file
·41 lines (30 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# set -x # enable debug output
set -e # exit on error
trap ErrorHandler ERR
function ErrorHandler {
echo -e "\e[91mError Occurred\e[0m"
exit 1
}
echo "Building Frontend"
cd html || return
npm install
npm run build
mkdir -p ../backend/app/server/static_files
rm -rf ../backend/app/server/static_files/*
cp -r dist/* ../backend/app/server/static_files/
echo "Building Backend"
cd ../backend/app || return
go build
if [ -e codejam.io ]; then
if [ -e /opt/codejam/codejam.io ]; then
rm /opt/codejam/codejam.io
else
echo "WARNING: Existing deployment not found"
fi
cp codejam.io /opt/codejam/codejam.io
else
echo -e "\e[92mBackend Build Failed: missing binary file found\e[0m"
exit 1
fi
echo -e "\e[32mSuccess\e[0m"