Skip to content

Instantly share code, notes, and snippets.

@smirnoffs
Created November 17, 2022 12:51
Show Gist options
  • Save smirnoffs/aaff4756e69fed2009f0d829e2072160 to your computer and use it in GitHub Desktop.
Save smirnoffs/aaff4756e69fed2009f0d829e2072160 to your computer and use it in GitHub Desktop.
Start AIOhttp web-server with external docker dependency and stop the container on SIGINT (ctrl+c)
#!/bin/bash
trap_ctrlc() {
echo "Stopping container"
cont_id=$(docker ps -q --filter name=my-container)
docker stop $cont_id
echo "Container stopped"
}
trap trap_ctrlc INT
if ! [[ $(docker ps -q --filter name=my-container) ]]; then
docker run -d -p 6000:5000 my-container
fi
.venv/bin/gunicorn main:get_async_wep_app_for_gunicorn \
--workers 2 \
--timeout 60 \
--reload \
--worker-class aiohttp.GunicornWebWorker --bind localhost:5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment