-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
27 lines (21 loc) · 743 Bytes
/
run.sh
File metadata and controls
27 lines (21 loc) · 743 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
#!/bin/bash
set -e
# Use the platform python
PY=python
# Create venv once under /home (persistent across restarts)
if [ ! -d "/home/venv" ]; then
$PY -m venv /home/venv
/home/venv/bin/pip install --upgrade pip wheel
fi
# Install/refresh deps if requirements.txt exists
if [ -f requirements.txt ]; then
/home/venv/bin/pip install -r requirements.txt
fi
# If gunicorn isn't in requirements, fallback install (optional)
if ! /home/venv/bin/python -c "import gunicorn" 2>/dev/null; then
/home/venv/bin/pip install gunicorn
fi
export PYTHONPATH=/home/site/wwwroot
# Start app; replace src.app:app if your WSGI path differs
exec /home/venv/bin/gunicorn --workers=2 --threads=4 --timeout=60 \
--bind 0.0.0.0:${PORT:-8000} src.app:app