Skip to content

Commit

Permalink
⚡️ add gunicorn for production
Browse files Browse the repository at this point in the history
  • Loading branch information
agn-7 committed Dec 21, 2023
1 parent 941fe06 commit dc0429e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ COPY pyproject.toml /app
COPY . /app
RUN poetry install

CMD ["./start_app.sh"]
CMD ["./start_app_production.sh"]
17 changes: 17 additions & 0 deletions start_app_production.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -eu

host=0.0.0.0
port=8000

get_absolute_path() {
cd "$(dirname "$1")" && pwd -P
}

cd "$(get_absolute_path "$0")" || exit 1

[[ "${HOST:-}" ]] && host="${HOST}"
[[ "${PORT:-}" ]] && port="${PORT}"
poetry run alembic upgrade head
poetry run gunicorn ifsguid.main:app -k uvicorn.workers.UvicornWorker --bind "${host}:${port}" --workers 9

0 comments on commit dc0429e

Please sign in to comment.