-
Notifications
You must be signed in to change notification settings - Fork 53
/
start.sh
executable file
·69 lines (55 loc) · 1.25 KB
/
start.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
echo "starting script"
# Loading env variables
export $(grep -v '^#' .env | xargs)
# echo ""
# echo "Loading azd .env file from current environment"
# echo ""
# while IFS='=' read -r key value; do
# value=$(echo "$value" | sed 's/^"//' | sed 's/"$//')
# export "$key=$value"
# done <<EOF
# $(azd env get-values)
# EOF
# if [ $? -ne 0 ]; then
# echo "Failed to load environment variables from azd environment"
# exit $?
# fi
echo 'Creating python virtual environment "backend/backend_env"'
python3 -m venv backend/backend_env
echo ""
echo "Restoring backend python packages"
echo ""
cd backend
./backend_env/bin/python3 -m pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo "Failed to restore backend python packages"
exit $?
fi
echo ""
echo "Restoring frontend npm packages"
echo ""
cd ../frontend
npm install
if [ $? -ne 0 ]; then
echo "Failed to restore frontend npm packages"
exit $?
fi
echo ""
echo "Building frontend"
echo ""
npm run build
if [ $? -ne 0 ]; then
echo "Failed to build frontend"
exit $?
fi
echo ""
echo "Starting backend"
echo ""
cd ../backend
xdg-open http://127.0.0.1:8000
./backend_env/bin/python3 ./app.py
if [ $? -ne 0 ]; then
echo "Failed to start backend"
exit $?
fi