23 lines
737 B
Bash
23 lines
737 B
Bash
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
|
||
# Ensure browsers are installed (the base image already has them, but this is safe)
|
||
python - <<'PY'
|
||
from pathlib import Path
|
||
from playwright.__main__ import main as pw
|
||
# no-op import ensures playwright is present; install step below is quick if cached
|
||
PY
|
||
|
||
# Run the app via gunicorn
|
||
# graceful-timeout - 300 ensures long page loads aren’t killed prematurely
|
||
# threads - 8 gives us more threads to work with
|
||
# gthread allows each worker to handle multiple threads, so async/blocking tasks like Playwright won’t block the whole worker
|
||
exec gunicorn \
|
||
--bind 0.0.0.0:8000 \
|
||
--workers 2 \
|
||
--threads 8 \
|
||
--worker-class gthread \
|
||
--timeout 300 \
|
||
--graceful-timeout 300 \
|
||
"app.wsgi:app"
|