mirror of
https://github.com/thib8956/nginx-proxy
synced 2024-11-22 03:46:29 +00:00
Trap TERM to allow quicker exit of web containers
This commit is contained in:
parent
f819a4e2e7
commit
098b058b0d
@ -108,15 +108,20 @@ function prepare_web_container {
|
|||||||
-w /var/www/ \
|
-w /var/www/ \
|
||||||
$options \
|
$options \
|
||||||
-e PYTHON_PORTS="$ports" \
|
-e PYTHON_PORTS="$ports" \
|
||||||
python:3 sh -c "
|
python:3 bash -c "
|
||||||
|
trap '[ \${#PIDS[@]} -gt 0 ] && kill -TERM \${PIDS[@]}' TERM
|
||||||
|
declare -a PIDS
|
||||||
for port in \$PYTHON_PORTS; do
|
for port in \$PYTHON_PORTS; do
|
||||||
echo starting a web server listening on port \$port;
|
echo starting a web server listening on port \$port;
|
||||||
mkdir /var/www/\$port
|
mkdir /var/www/\$port
|
||||||
cd /var/www/\$port
|
cd /var/www/\$port
|
||||||
echo \"answer from port \$port\" > data
|
echo \"answer from port \$port\" > data
|
||||||
python -m http.server \$port &
|
python -m http.server \$port &
|
||||||
|
PIDS+=(\$!)
|
||||||
done
|
done
|
||||||
wait
|
wait \${PIDS[@]}
|
||||||
|
trap - TERM
|
||||||
|
wait \${PIDS[@]}
|
||||||
"
|
"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user