-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·34 lines (26 loc) · 859 Bytes
/
Copy pathsetup.sh
File metadata and controls
executable file
·34 lines (26 loc) · 859 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
#!/usr/bin/env bash
set -euo pipefail
PY_BIN="${PY_BIN:-python3}"
VENV_DIR="${VENV_DIR:-.venv}"
RUN_AFTER_SETUP="${RUN_AFTER_SETUP:-1}"
echo ">> Using Python: ${PY_BIN}"
echo ">> Creating virtual environment at: ${VENV_DIR}"
"${PY_BIN}" -m venv "${VENV_DIR}"
if [[ ! -f "${VENV_DIR}/bin/activate" ]]; then
echo "Virtual environment activation script not found."
exit 1
fi
# shellcheck disable=SC1090
source "${VENV_DIR}/bin/activate"
echo ">> Upgrading pip/setuptools/wheel"
python -m pip install --upgrade pip setuptools wheel
echo ">> Installing pinned dependencies"
pip install -r requirements.txt
echo ">> Setup complete."
echo ">> To activate later: source ${VENV_DIR}/bin/activate"
if [[ "${RUN_AFTER_SETUP}" == "1" ]]; then
echo ">> Launching app..."
python main.py
else
echo ">> Skipping run (RUN_AFTER_SETUP=${RUN_AFTER_SETUP})"
fi