-
Notifications
You must be signed in to change notification settings - Fork 2
/
manager.sh
executable file
·50 lines (44 loc) · 1.32 KB
/
manager.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
#!/bin/bash
# Runs/Installs app
echo "This script should be running in repository directory."
if [ "$1" == "install" ]; then
if [ ! -d ".venv" ]; then
echo "Creating virtual environment"
python3 -m venv .venv
else
echo "Virtual environment already exists"
echo "Use 'rm .venv' to remove it"
exit 1
fi
source .venv/bin/activate
pip install -r torchreqs.txt
pip install -r webreqs.txt
mkdir static
elif [ "$1" == "run" ]; then
if [ ! -d ".venv" ]; then
echo "Virtual environment does not exist"
echo "Use 'install' to create it"
exit 1
fi
echo "If the URL does not root to /, enter base URI into second paramater."
echo "Format for that is /base_uri"
if [ -z CODESPACE_NAME ]; then
CODESPACE_URI="https://${CODESPACE_NAME}-8000.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
else
CODESPACE_URI=""
fi
if [ CODESPACE_URI != "https://-8000." ]; then
echo "Auto detected codespace URI: ${CODESPACE_URI}"
fi
source .venv/bin/activate
if [ "$2" == "" ]; then
export BASE_URI=$CODESPACE_URI
else
export BASE_URI=$2
fi
echo "Using URI: ${BASE_URI}"
uvicorn app.web:app --host 0.0.0.0 --reload
else
echo "Invalid argument"
echo "Use 'install' or 'run'"
fi